Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent fmt::Arguments from being shared across threads #45198

Merged
merged 2 commits into from
Nov 22, 2017

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Oct 11, 2017

Fixes #45197

This is a breaking change! Without doing this it's very easy to create race conditions.

There's probably a way to do this without breaking valid use cases, but it would require quite an overhaul of the formatting machinery.

@arielb1
Copy link
Contributor

arielb1 commented Oct 11, 2017

I would prefer to put a PhantomData<*mut TraitObject> type there (e.g. PhantomData<*mut Fn()>) - that would prohibit all OIBITs.

@oli-obk
Copy link
Contributor Author

oli-obk commented Oct 11, 2017

Done

r? @arielb1

@@ -12,6 +12,7 @@
// aux-build:span-test-macros.rs

// ignore-pretty
// ignore-stage1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are you changing a test that should be unaffected? Is this only for the snapshot? In that case, I think you should add a SNAP: remove after snapshot comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been testing the fmt::Arguments changes on stage 1, but it keeps failing on this test even without my changes. Someone forgot to add the flag, which is required for most proc-macro tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it has anything to do with snapshots, just with compiler plugins. I can remove this comment from this PR. It's just an annoyance I encountered

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed and squashed

@arielb1
Copy link
Contributor

arielb1 commented Oct 11, 2017

@bors r+

@bors
Copy link
Contributor

bors commented Oct 11, 2017

📌 Commit 787f9f4 has been approved by arielb1

@arielb1
Copy link
Contributor

arielb1 commented Oct 11, 2017

Umm I would actually rather like a comment on _oibit_remover explaining its purpose.

@bors r-

@arielb1
Copy link
Contributor

arielb1 commented Oct 11, 2017

@bors r+

@bors
Copy link
Contributor

bors commented Oct 11, 2017

📌 Commit dc7de37 has been approved by arielb1

@arielb1
Copy link
Contributor

arielb1 commented Oct 11, 2017

@bors rollup

@ghost
Copy link

ghost commented Oct 11, 2017

@arielb1
Out of curiousity, is there any difference between PhantomData<*mut u8> and PhantomData<*mut Fn()>?

kennytm added a commit to kennytm/rust that referenced this pull request Oct 11, 2017
Prevent fmt::Arguments from being shared across threads

Fixes rust-lang#45197

This is a **breaking change**! Without doing this it's very easy to create race conditions.

There's probably a way to do this without breaking valid use cases, but it would require quite an overhaul of the formatting machinery.
@Mark-Simulacrum Mark-Simulacrum added the relnotes Marks issues that should be documented in the release notes of the next release. label Oct 11, 2017
@Mark-Simulacrum
Copy link
Member

@bors r-

@Mark-Simulacrum
Copy link
Member

@rust-lang/libs -- nominating for discussion, I think this (as a breaking change) deserves some discussion before merging.

@Mark-Simulacrum Mark-Simulacrum added I-nominated T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Oct 11, 2017
@alexcrichton
Copy link
Member

Ideally we'd have a crater run to evaluate the impact here, but on the other hand it's not like we're not going to fix this. Rather, we may fix it more slowly if this ends up having a lot of fallout.

In any case I'd personally be ok landing this as-is as it's on nightly and we can always revert it if the problem is too widespread.

@sfackler
Copy link
Member

I agree. It seems pretty unlikely to me that anyone is writing code that depends on the Send or Sync-ness here.

@arielb1
Copy link
Contributor

arielb1 commented Oct 11, 2017

@arielb1
Out of curiousity, is there any difference between PhantomData<*mut u8> and PhantomData<*mut Fn()>?

Sure. Only the latter prevents OIBITs.

@cuviper
Copy link
Member

cuviper commented Oct 11, 2017

@arielb1
Out of curiousity, is there any difference between PhantomData<*mut u8> and PhantomData<*mut Fn()>?

Sure. Only the latter prevents OIBITs.

Whereas PhantomData<*mut u8> only prevents Send and Sync in particular?

@arielb1
Copy link
Contributor

arielb1 commented Oct 11, 2017

Whereas PhantomData<*mut u8> only prevents Send and Sync in particular?

It "accidentally" prevents Send and Sync becuase *mut T is neither of these.

@Mark-Simulacrum
Copy link
Member

@bors try

Well, I'll start a try build so that we can get a cargobomb run complete sooner should we decide to go that route.

I don't think we should merge without results from that, but am fine with being overruled.

@bors
Copy link
Contributor

bors commented Oct 11, 2017

⌛ Trying commit dc7de37 with merge e7aa529cd92736ab0f7400ad33835c5f64e93fc7...

@kennytm kennytm added the S-waiting-on-crater Status: Waiting on a crater run to be completed. label Oct 28, 2017
@kennytm
Copy link
Member

kennytm commented Oct 28, 2017

@oli-obk Two PRs are pending at the moment (#45333, #45205), one is queued (#45225).

Since there are no new commits, do we reuse the existing try build or generate a new one?

@carols10cents carols10cents removed the S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). label Oct 30, 2017
@alexcrichton
Copy link
Member

@aidanhs just checking in, is this unblocked now to get another crater run?

@alexcrichton
Copy link
Member

@kennytm oh to answer your question I think it's ok to use the same artifacts from before.

@aidanhs
Copy link
Member

aidanhs commented Nov 3, 2017

Crater run started.

@cuviper
Copy link
Member

cuviper commented Nov 8, 2017

@aidanhs Did crater finish this?

@Mark-Simulacrum
Copy link
Member

@cuviper
Copy link
Member

cuviper commented Nov 8, 2017

@dpc it looks like the slog fix was merged into the 1.5.0 branch, but not the 1.x.y branch from which you released slog-1.6.0.

@dpc
Copy link
Contributor

dpc commented Nov 8, 2017

Oh my. Sorry. I've added it to the 1.x.y branch: https://github.com/slog-rs/slog/commits/1.x.y and I've published 1.7.1 with another nightly fix and since this is passing: https://travis-ci.org/slog-rs/slog/builds/299306472 I think we're good now. Please double check.

@carols10cents
Copy link
Member

@aidanhs @Mark-Simulacrum looks like this might need another crater run?

@Mark-Simulacrum
Copy link
Member

It'll probably be at least 8-10 days before Crater is ready for this PR -- we have 2 in queue right now. If the last Crater run only recorded problems due to slog failing, them I'm somewhat inclined to just push this through -- @rust-lang/libs: What do you think? We'll run crater on beta anyway, so I'm not too worried...

@kennytm
Copy link
Member

kennytm commented Nov 13, 2017

Could we just run a "mini-crater" test on those 62 regressed crates?

@Mark-Simulacrum
Copy link
Member

Seems possible, not sure -- @aidanhs may be able to comment on that, I don't know crater internals well enough to.

@kennytm kennytm added the S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). label Nov 14, 2017
@sfackler
Copy link
Member

It has now been over a month. I am going to r+ this thing in an hour unless someone strenuously objects.

@Mark-Simulacrum
Copy link
Member

@bors r=sfackler

Yeah, we should've pushed this through faster. I believe there are no significant remaining concerns, and beta just branched, so I'm happy to let this bake on nightly.

@bors
Copy link
Contributor

bors commented Nov 22, 2017

📌 Commit dc7de37 has been approved by sfackler

@kennytm kennytm added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). labels Nov 22, 2017
@kennytm
Copy link
Member

kennytm commented Nov 22, 2017

@bors rollup-

Better not to roll this up given the potential breakage.

@bors
Copy link
Contributor

bors commented Nov 22, 2017

⌛ Testing commit dc7de37 with merge 1dc0b57...

bors added a commit that referenced this pull request Nov 22, 2017
Prevent fmt::Arguments from being shared across threads

Fixes #45197

This is a **breaking change**! Without doing this it's very easy to create race conditions.

There's probably a way to do this without breaking valid use cases, but it would require quite an overhaul of the formatting machinery.
@bors
Copy link
Contributor

bors commented Nov 22, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: sfackler
Pushing 1dc0b57 to master...

@bors bors merged commit dc7de37 into rust-lang:master Nov 22, 2017
@oli-obk oli-obk deleted the fmt_args branch June 15, 2020 15:26
@bjorn3 bjorn3 mentioned this pull request Dec 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
relnotes Marks issues that should be documented in the release notes of the next release. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.