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

Chained lazy vals can cause deadlocks #5808

Closed
scabug opened this issue May 19, 2012 · 6 comments
Closed

Chained lazy vals can cause deadlocks #5808

scabug opened this issue May 19, 2012 · 6 comments

Comments

@scabug
Copy link

scabug commented May 19, 2012

The following deadlocks:

object LazyValDeadLock extends App {
  println((new Z).Y)
}

class Z {
  lazy val X = 0
  lazy val Y = {
    // 'mentioning' X here solves the problem:
    // X
    for (i <- 0 until 2 par) yield {
      println(i)
      X
    }
  }
}
@scabug
Copy link
Author

scabug commented May 19, 2012

Imported From: https://issues.scala-lang.org/browse/SI-5808?orig=1
Reporter: Scott Morrison (scott)
Affected Versions: 2.9.2, 2.10.0-M3

@scabug
Copy link
Author

scabug commented May 21, 2012

Scott Morrison (scott) said:
(Modified code sample, so the lazy vals are not in the App; hopefully clearer.)

@scabug
Copy link
Author

scabug commented May 21, 2012

Scott Morrison (scott) said:
As Viktor explains on [scala-user] https://groups.google.com/d/msg/scala-user/JDODbZp-c1k/3JdGUkkKoWEJ, this is 'user-error', until SUGGEST-11 is implemented.

@scabug
Copy link
Author

scabug commented May 21, 2012

Scott Morrison (scott) said:
Just an instance of the problem described by SUGGEST-11.

@scabug scabug closed this as completed May 21, 2012
@scabug
Copy link
Author

scabug commented Jan 20, 2017

Julien Diener (julien-diener) said (edited on Jan 20, 2017 12:20:50 PM UTC):
I found the same bug, is it supposed to be solved?
The suggest linked above is closed

Note the bug can be synthesized with the following code example:

object o{
  lazy val a = 1
  lazy val b = (1 to 1).par.map( i => o.a + i )
}    
o.b // never ends

@scabug
Copy link
Author

scabug commented Jan 20, 2017

@som-snytt said:
SIP is at the SIP page but I'm not sure what the status is.

It would be nice for the issue tracker to track SIPs for easy linking, maybe as a dedicated "Type" (SIP) or "Status" (Sipped).

The behavior is "not a bug" (because it's a feature or implementation detail) but also not "won't fix"; it's "out of scope" for an ordinary issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant