Skip to content

DumpCoroutineInfoAsJsonAndReferencesTest.testDumpWithNoCoroutines spuriously fails on Mac OS X #3028

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

Closed
qwwdfsad opened this issue Nov 17, 2021 · 2 comments
Assignees
Labels

Comments

@qwwdfsad
Copy link
Member

java.util.NoSuchElementException
	at kotlinx.coroutines.debug.internal.ConcurrentWeakMap$Core$KeyValueIterator.next(ConcurrentWeakMap.kt:232)
	at kotlin.collections.CollectionsKt___CollectionsKt.toList(_Collections.kt:1313)
	at kotlin.collections.CollectionsKt___CollectionsKt.sortedWith(_Collections.kt:1071)
	at kotlinx.coroutines.debug.internal.DebugProbesImpl.dumpCoroutinesInfo(DebugProbesImpl.kt:643)
	at kotlinx.coroutines.debug.internal.DebugProbesImpl.dumpCoroutinesInfoAsJsonAndReferences(DebugProbesImpl.kt:186)
	at kotlinx.coroutines.debug.DumpCoroutineInfoAsJsonAndReferencesTest.testDumpWithNoCoroutines(DumpCoroutineInfoAsJsonAndReferencesTest.kt:34)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at kotlinx.coroutines.debug.junit4.CoroutinesTimeoutStatement$evaluate$$inlined$runWithTimeoutDumpingCoroutines$1.call(CoroutinesTimeoutImpl.kt:83)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.lang.Thread.run(Thread.java:829)
@qwwdfsad qwwdfsad added the build label Nov 17, 2021
@qwwdfsad qwwdfsad self-assigned this Nov 17, 2021
@qwwdfsad
Copy link
Member Author

qwwdfsad commented Nov 17, 2021

Interesting part of toList:

return when (size) {
            0 -> emptyList()
            1 -> listOf(if (this is List) get(0) else iterator().next())
            else -> this.toMutableList()
        }

Seems like in some circumstances toList is able to observe size being 1

qwwdfsad added a commit that referenced this issue Nov 17, 2021
Otherwise, multiple pairs of install + uninstall may leave multiple cleanup threads in the state when the map is already cleaned up, but its size is not

Fixes #3028
qwwdfsad added a commit that referenced this issue Nov 17, 2021
Otherwise, multiple pairs of install + uninstall may leave multiple cleanup threads in the state when the map is already cleaned up, but its size is not

Fixes #3028
qwwdfsad added a commit that referenced this issue Nov 19, 2021
* Try to trim memory usage of Dokka and Lincheck
* Disable failing test
* Do avoid concurrent-unsafe Collections.toList for working with ConcurrentWeakMap.keySet
* Do join weakRefCleanerThread in DebugProbes.uninstall

Otherwise, multiple pairs of install + uninstall may leave multiple cleanup threads in the state when the map is already cleaned up, but its size is not

Fixes #3028
@qwwdfsad
Copy link
Member Author

Fixed

yorickhenning pushed a commit to yorickhenning/kotlinx.coroutines that referenced this issue Jan 28, 2022
* Try to trim memory usage of Dokka and Lincheck
* Disable failing test
* Do avoid concurrent-unsafe Collections.toList for working with ConcurrentWeakMap.keySet
* Do join weakRefCleanerThread in DebugProbes.uninstall

Otherwise, multiple pairs of install + uninstall may leave multiple cleanup threads in the state when the map is already cleaned up, but its size is not

Fixes Kotlin#3028
pablobaxter pushed a commit to pablobaxter/kotlinx.coroutines that referenced this issue Sep 14, 2022
* Try to trim memory usage of Dokka and Lincheck
* Disable failing test
* Do avoid concurrent-unsafe Collections.toList for working with ConcurrentWeakMap.keySet
* Do join weakRefCleanerThread in DebugProbes.uninstall

Otherwise, multiple pairs of install + uninstall may leave multiple cleanup threads in the state when the map is already cleaned up, but its size is not

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

No branches or pull requests

1 participant