I've been observing a stray flow invariant violati...
# ktor
o
I've been observing a stray flow invariant violation which I've been unable to reproduce, with the two contexts in question looking identical:
Copy code
2023-09-04T20:40:38.395Z ERROR 'subscription update processing finished with java.lang.IllegalStateException: Flow invariant is violated:
		Flow was collected in [CoroutineName(Subscription-Updater-Database("main")), CoroutineId(2), "Subscription-Updater-Database("main")#2":StandaloneCoroutine{Active}@1644d16a, io.ktor.server.engine.ClassLoaderAwareContinuationInterceptor@67c54a72],
		but emission happened in [CoroutineName(Subscription-Updater-Database("main")), CoroutineId(2), "Subscription-Updater-Database("main")#2":StandaloneCoroutine{Active}@1644d16a, io.ktor.server.engine.ClassLoaderAwareContinuationInterceptor@67c54a72].
		Please refer to 'flow' documentation or use 'flowOn' instead' : 35734d0d15433c541b408e00e0d868dc 9ee76fc416a8e2e1 [scopeInfo: app.backend.database.DatabaseKt:] {}
As Ktor server was running in development mode at the time, is it reasonable to assume that this was probably caused by Ktor trying to reload classes in between?
a
Yes, this might cause the problem.
o
Should I file an issue to consider • updating the docs with a warning, or • adding some code to Ktor which might help to explain the issue?
a
Please file an issue with an attached code snippet to reproduce the violation.
o
That's the problem: I haven't been able to reproduce it. Would probably require a class reload to happen with specific timing.