Skip to content

Conversation

@eed3si9n
Copy link
Member

@eed3si9n eed3si9n commented Dec 10, 2024

Fixes #7873

Problem

Early initialization thread throws ConcurrentModificationException.

Solution

This wraps the initialization with Retry(...).

@eed3si9n eed3si9n changed the title fix: concurrency control around Scala 3 compiler [2.x] fix: concurrency control around Scala 3 compiler Dec 10, 2024
**Problem**
Early initialization thread throws ConcurrentModificationException.

**Solution**
This puts in synchronized to lock for the access.
Copy link
Member

@adpi2 adpi2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this fixes the concurrency issue.

Looking at the stack trace, it seems that dotty is iterating the System.properties while another thread modifies them. Could it be that sbt, or a plugin modifies the System.properties?

@eed3si9n
Copy link
Member Author

https://eed3si9n.com/december-adventure-2024/ has commentary on the whereabout of the thread.

Copy link
Member

@adpi2 adpi2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@eed3si9n eed3si9n merged commit ebee3a8 into sbt:develop Dec 10, 2024
13 checks passed
@eed3si9n eed3si9n deleted the wip/concurrent branch December 10, 2024 13:30
private[sbt] val defaultGlobalForParser = ParseDriver()
// Retry since Scala 3 compiler initialization can fail due to sys.props change
private[sbt] val defaultGlobalForParser: ParseDriver =
Retry(ParseDriver())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this Retry did not work because it just retries IOException...

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

Successfully merging this pull request may close these issues.

3 participants