Skip to content

Periodic crash during Pkl parsing #1553

@sgammon

Description

@sgammon

Expected Behavior

Using Elide with a elide.pkl manifest should work consistently

Actual Behaviour

Using Elide (at edge) with a elide.pkl manifest sometimes crashes (about 10% of the time). This bug has been observed locally via both dev builds and opt builds, so it is likely a race condition which is unrelated to compiler optimizations.

Stacktrace

Uncaught fatal exception: org.graalvm.polyglot.PolyglotException: java.util.ConcurrentModificationException
[email protected]/java.util.HashMap.computeIfAbsent(HashMap.java:1230)
org.graalvm.truffle/com.oracle.truffle.api.impl.ThreadLocalHandshake.getThreadState(ThreadLocalHandshake.java:561)
org.graalvm.truffle.runtime.svm/com.oracle.svm.truffle.api.SubstrateThreadLocalHandshake.ensureThreadInitialized(SubstrateThreadLocalHandshake.java:133)
org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotThreadLocalActions.notifyEnterCreatedThread(PolyglotThreadLocalActions.java:157)
org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotContextImpl.enterThreadChanged(PolyglotContextImpl.java:1029)
org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotEngineImpl.enterCached(PolyglotEngineImpl.java:2155)
org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotEngineImpl.enterIfNeeded(PolyglotEngineImpl.java:2083)
org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotValueDispatch.hostEnter(PolyglotValueDispatch.java:1285)
org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotContextImpl.initializeLanguage(PolyglotContextImpl.java:1847)
org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotContextDispatch.initializeLanguage(PolyglotContextDispatch.java:57)
org.graalvm.polyglot/org.graalvm.polyglot.Context.initialize(Context.java:617)
org.pkl.core.runtime.VmUtils.createContext(VmUtils.java:105)
org.pkl.core.EvaluatorImpl.<init>(EvaluatorImpl.java:92)
org.pkl.core.EvaluatorBuilder.build(EvaluatorBuilder.java:530)
org.pkl.config.java.ConfigEvaluatorBuilder.build(ConfigEvaluatorBuilder.java:321)
elide.tooling.project.codecs.ElidePackageManifestCodec.parse(ElidePackageManifestCodec.kt:235)
elide.tooling.project.codecs.ElidePackageManifestCodec.parse(ElidePackageManifestCodec.kt:43)
elide.tooling.project.CompositePackageManifestService.parse(CompositePackageManifestService.kt:98)
elide.tool.project.DefaultProjectManager$resolveProject$2$rootManifestOp$1.invokeSuspend(DefaultProjectManager.kt:117)
kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)
kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:586)
kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:820)
kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:717)
kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:704)
org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:832)
org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:808)
org.graalvm.polyglot.PolyglotException: java.util.ConcurrentModificationException
	at [email protected]/java.util.HashMap.computeIfAbsent(HashMap.java:1230)
	at org.graalvm.truffle/com.oracle.truffle.api.impl.ThreadLocalHandshake.getThreadState(ThreadLocalHandshake.java:561)
	at org.graalvm.truffle.runtime.svm/com.oracle.svm.truffle.api.SubstrateThreadLocalHandshake.ensureThreadInitialized(SubstrateThreadLocalHandshake.java:133)
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotThreadLocalActions.notifyEnterCreatedThread(PolyglotThreadLocalActions.java:157)
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotContextImpl.enterThreadChanged(PolyglotContextImpl.java:1029)
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotEngineImpl.enterCached(PolyglotEngineImpl.java:2155)
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotEngineImpl.enterIfNeeded(PolyglotEngineImpl.java:2083)
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotValueDispatch.hostEnter(PolyglotValueDispatch.java:1285)
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotContextImpl.initializeLanguage(PolyglotContextImpl.java:1847)
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotContextDispatch.initializeLanguage(PolyglotContextDispatch.java:57)
	at org.graalvm.polyglot/org.graalvm.polyglot.Context.initialize(Context.java:617)
	at org.pkl.core.runtime.VmUtils.createContext(VmUtils.java:105)
	at org.pkl.core.EvaluatorImpl.<init>(EvaluatorImpl.java:92)
	at org.pkl.core.EvaluatorBuilder.build(EvaluatorBuilder.java:530)
	at org.pkl.config.java.ConfigEvaluatorBuilder.build(ConfigEvaluatorBuilder.java:321)
	at elide.tooling.project.codecs.ElidePackageManifestCodec.parse(ElidePackageManifestCodec.kt:235)
	at elide.tooling.project.codecs.ElidePackageManifestCodec.parse(ElidePackageManifestCodec.kt:43)
	at elide.tooling.project.CompositePackageManifestService.parse(CompositePackageManifestService.kt:98)
	at elide.tool.project.DefaultProjectManager$resolveProject$2$rootManifestOp$1.invokeSuspend(DefaultProjectManager.kt:117)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:586)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:820)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:717)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:704)
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:832)
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:808)
	Suppressed: Attached Guest Language Frames (0)
Internal GraalVM error, please report at https://github.com/oracle/graal/issues/.
Exiting with code -1 due to uncaught org.graalvm.polyglot.PolyglotException: java.util.ConcurrentModificationException

Steps To Reproduce

  1. Build Elide from the current release PR
  2. Try to use it in manual testing
  3. Projects with elide.pkl fail about 10% of the time with the above exception

Environment Information

  • Operating System: macOS
  • Architecture: M-series (ARM64)

Runtime

Native

Language

N/A (Default)

Example Application

No response

Version

1.0.0-beta8-rc3

Metadata

Metadata

Assignees

Labels

P0arch:arm64Issues relating to arm64bugSomething isn't workingplatform:macosIssues relating to macOS

Type

Projects

Status

No status

Relationships

None yet

Development

No branches or pull requests

Issue actions