Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

fix Issue 22774 - TraceInfo is gathered only once when throwing a Thr… #3742

Closed
wants to merge 1 commit into from
Closed

fix Issue 22774 - TraceInfo is gathered only once when throwing a Thr… #3742

wants to merge 1 commit into from

Conversation

mkykadir
Copy link

…owable

Update info during every throw

@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @mkykadir! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Auto-close Bugzilla Severity Description
22774 minor TraceInfo is gathered only once when throwing a Throwable

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + druntime#3742"

@dlang-bot dlang-bot added the Bug Fix Include reference to corresponding bugzilla issue label Feb 15, 2022
@thewilsonator
Copy link
Contributor

I think the fix for this should be in user code to set t.info = null if you want a new trace using the same throwable object.

@Geod24
Copy link
Member

Geod24 commented Feb 15, 2022

I think the fix for this should be in user code [...]

Why would one want this behavior ?

@thewilsonator
Copy link
Contributor

Unless the red in the CI is unrelated, then this break a whole lot of stuff.

@mkykadir
Copy link
Author

Unless the red in the CI is unrelated, then this break a whole lot of stuff.

Investigating this but generally time-out during fail-compilation tests (randomly); for example stuck at
... fail_compilation/test16116.d -verrors=0 -m64 -fPIC ()

@mkykadir
Copy link
Author

mkykadir commented Feb 21, 2022

OK, one of the causes that I could find is this, this changeset conflicts with it. Exceptional cases when GC cannot be trusted (i.e. memory exceptions) are single instanced; and TraceInfo should not be constructed; this changeset causes that.

@kinke
Copy link
Contributor

kinke commented Feb 26, 2022

I think the fix for this should be in user code [...]

Why would one want this behavior ?

In C#, there's a difference between throw; (a rethrow with the same context) and throw e; (new context): https://stackoverflow.com/questions/730250/is-there-a-difference-between-throw-and-throw-ex

In D:

try { foo(); }
catch (Exception e) { logException(e); throw e; } // keep the existing TraceInfo!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Fix Include reference to corresponding bugzilla issue stalled
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants