D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 15822 - InvalidMemoryOperationError when calling GC.removeRange/Root from a finalizer
Summary: InvalidMemoryOperationError when calling GC.removeRange/Root from a finalizer
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: druntime (show other issues)
Version: D2
Hardware: All All
: P1 regression
Assignee: No Owner
URL:
Keywords: pull
: 15808 15809 15821 (view as issue list)
Depends on:
Blocks:
 
Reported: 2016-03-23 07:27 UTC by Martin Nowak
Modified: 2018-01-05 13:27 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Martin Nowak 2016-03-23 07:27:21 UTC
Introduced by https://github.com/D-Programming-Language/druntime/pull/1447.
Comment 2 Martin Nowak 2016-03-23 08:29:49 UTC
*** Issue 15809 has been marked as a duplicate of this issue. ***
Comment 3 Martin Nowak 2016-03-23 08:32:31 UTC
*** Issue 15821 has been marked as a duplicate of this issue. ***
Comment 4 Martin Nowak 2016-03-23 08:33:30 UTC
*** Issue 15808 has been marked as a duplicate of this issue. ***
Comment 5 github-bugzilla 2016-03-23 11:43:12 UTC
Commits pushed to stable at https://github.com/D-Programming-Language/druntime

https://github.com/D-Programming-Language/druntime/commit/d23d7efb3649cd543e8d0b10b9a32ab3325f5cd0
fix Issue 15822 - InvalidMemoryOperationError when calling GC.removeRange/Root from a finalizer

- use separate locks for GC.add/removeRange/Root
- avoids GC.lock contention for manual memory management

https://github.com/D-Programming-Language/druntime/commit/c6ac077a8d544fab65b1973b385c6f479697fb0e
Merge pull request #1519 from MartinNowak/fix15822

fix Issue 15822 - InvalidMemoryOperationError when calling GC.removeRange/Root from a finalizer
Comment 6 hsteoh 2016-03-23 19:16:18 UTC
This bug has not yet been (fully) fixed:

------
import std.stdio;
class Wrapper
{
    typeof(stdin.byLine()) src;
}
void main()
{
    auto x = new Wrapper();
    x.src = stdin.byLine();
}
------

Run as 'echo | ./program'. Output:

------
core.exception.InvalidMemoryOperationError@src/core/exception.d(693): Invalid memory operation
------
Comment 7 ag0aep6g 2016-03-23 19:23:40 UTC
(In reply to hsteoh from comment #6)
> This bug has not yet been (fully) fixed:
> 
> ------
> import std.stdio;
> class Wrapper
> {
>     typeof(stdin.byLine()) src;
> }
> void main()
> {
>     auto x = new Wrapper();
>     x.src = stdin.byLine();
> }
> ------
> 
> Run as 'echo | ./program'. Output:
> 
> ------
> core.exception.InvalidMemoryOperationError@src/core/exception.d(693):
> Invalid memory operation
> ------

Works for me. Are you testing with stable?
Comment 8 hsteoh 2016-03-23 19:28:59 UTC
Oh, was this only fixed in stable?

I'm testing with latest git HEAD.
Comment 9 ag0aep6g 2016-03-23 20:00:12 UTC
(In reply to hsteoh from comment #8)
> Oh, was this only fixed in stable?

Yup.

> I'm testing with latest git HEAD.

I'm closing as fixed again, assuming it works for you with stable.
Comment 10 hsteoh 2016-03-24 02:33:21 UTC
Why aren't we fixing this in git HEAD?!
Comment 11 ag0aep6g 2016-03-24 05:40:10 UTC
(In reply to hsteoh from comment #10)
> Why aren't we fixing this in git HEAD?!

It's a regression. Those are fixed against stable, from which point releases are built. As far as I understand, stable is merged back into master from time to time (don't know if there are any rules about it). So the fix should reach master eventually.
Comment 12 github-bugzilla 2016-03-24 07:09:54 UTC
Commits pushed to master at https://github.com/D-Programming-Language/druntime

https://github.com/D-Programming-Language/druntime/commit/d23d7efb3649cd543e8d0b10b9a32ab3325f5cd0
fix Issue 15822 - InvalidMemoryOperationError when calling GC.removeRange/Root from a finalizer

https://github.com/D-Programming-Language/druntime/commit/c6ac077a8d544fab65b1973b385c6f479697fb0e
Merge pull request #1519 from MartinNowak/fix15822
Comment 13 hsteoh 2016-03-24 15:15:17 UTC
Thanks!!
Comment 14 github-bugzilla 2018-01-05 13:27:23 UTC
Commits pushed to dmd-cxx at https://github.com/dlang/druntime

https://github.com/dlang/druntime/commit/d23d7efb3649cd543e8d0b10b9a32ab3325f5cd0
fix Issue 15822 - InvalidMemoryOperationError when calling GC.removeRange/Root from a finalizer

https://github.com/dlang/druntime/commit/c6ac077a8d544fab65b1973b385c6f479697fb0e
Merge pull request #1519 from MartinNowak/fix15822