-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Drop implementations not being called on panic with Fat LTO. #64655
Copy link
Copy link
Closed
Labels
A-destructorsArea: Destructors (`Drop`, …)Area: Destructors (`Drop`, …)C-bugCategory: This is a bug.Category: This is a bug.P-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Metadata
Metadata
Assignees
Labels
A-destructorsArea: Destructors (`Drop`, …)Area: Destructors (`Drop`, …)C-bugCategory: This is a bug.Category: This is a bug.P-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Hi,
It looks like calls to
Drop::drop()are getting removed when usinglto = "fat"for a release build. It doesn't seem to occur withlto = "thin"orlto = "no".I've got a test case here: https://github.com/cstorey/fat-lto-drop-repro, which can be reproduced like this:
(more details in the transcript)
For context, I first noticed this in a project where I am using an
mpsc::channelto communciate between threads, where a producer thread reads messages from the network, and the main thread saves those to a database.I was relying on the fact that the
Dropimplementation for a channel will in effect close the channel, so the main thread can find out that the producer has failed, and so we should kill the process. What I saw instead was the producer thread panicing, but the main thread would never get woken up.I've seen this on macOS
Darwin 17.7.0 x86_64and Linux5.0.0-25-generic #26-Ubuntu SMP Thu Aug 1 12:04:58 UTC 2019 x86_64.