-
Notifications
You must be signed in to change notification settings - Fork 21
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
Cyclic object initialization between Predef and collection.immutable.Vector #13009
Comments
Note that the deadlock happens only when using the The following does not deadlock:
The following does deadlock:
Both are 2.13.14, but one is the released library and the other is We think this is because the build process for the released version does more inlining than the In particular, the call to |
I fixed the PR comment to reference this ticket. Comments there note that it is a difference with inlining (qua optimization). Edit: Edit again: maybe the previous comment was using "royal we" to express the linked PR comments. |
Add Color.scala to black list The test added in #20356 seems to break `test_scala2_library_tasty`, due to a [problem](scala/bug#13009) in Scala 2 library. [test_scala2_library_tasty]
Description
The source code of the standard library includes object initialization cycles, including a cycle between
Predef
andcollection.immutable.Vector
, which could lead to deadlock when two threads initialize them simultaneously.Test
deadlock.scala
Reproduction steps
Scala version: (2.13.15)
Problem
The test deadlocks due to cyclic initialization between
Predef
andcollection.immutable.Vector
. Specifically,Predef
triggers initialization ofVector
throughand the constructor of Vector contains another call to
Predef.augmentString
, as shown in Vector.tastyThe warning is given by the global initialization checker that is under development to fix initialization warning in standard tasty library (scala/scala3#18882), and this issue is linked to a PR with a fix to manually inline the call to
Predef.augmentString
(scala/scala#10793). Our current conclusion is that such calls must be inlined to ensure soundness, which may happen in released build.To reproduce the warning using the global initialization checker, apply the following patch to Dotty main branch:
and in sbt:
The checker will report the following warning:
The text was updated successfully, but these errors were encountered: