question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Serializability of coroutine classes

See original GitHub issue

Currently, if you attempt to serialize coroutine state via standard Java Serialization the tree of reference leads you to the objects defined in kotlinx.coroutines like StandaloneCoroutine (which serves as a completion for launched coroutines) and its contexts (like CommonPool) which are not currently serializable. They should be made properly serializable.

See also https://github.com/Kotlin/kotlin-coroutines/issues/28

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:9
  • Comments:56 (19 by maintainers)

github_iconTop GitHub Comments

9reactions
joost-de-vriescommented, May 5, 2019

I think it would be very useful to implement long running business processes. The tools that are available for this are usually proprietary using some incomplete home brew expression language and flow control. And almost all of them use proprietary storage and run platform. As a result you can’t use proper version control, proper debugging, proper module reuse, proper cloud deployment etc. So I being able to use coroutines to implement this would be incredibly exciting.

4reactions
elizarovcommented, May 20, 2020

@pdvrieze I’m thinking along the lines that if we go with kotlinx.serialzation support in the future, then we’ll be explicitly annotating suspending functions and lambda as @Serializable and the compiler will guarantee that they only capture and work with serializable classes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Serializable class with coroutines? - Stack Overflow
I have a class, which I want to make serializable (to see some public variables in the inspector), but I also need to...
Read more >
Serializable class with coroutines? - Unity Answers
Serializable class with coroutines? I have a class, which I want to make serializable (to see some public variables in the inspector), but...
Read more >
Make SafeContinuation and context impl classes serializable
The following classes from kotlin.coroutines.experimental package shall be made serializable so that coroutines can be readily serialized with Java ...
Read more >
Serializable Coroutines for the HotSpot™ Java Virtual Machine
4.2.8 The CoroutineSupport Class . ... It only needs to take care of non-serializable classes, as shown in Section 5.2. In a more...
Read more >
Is it possible to serialize a Kotlin coroutine and resume it later ...
Theoretically yes. However, there's no guarantee that the captured stack is fully serializable. AFAIK it's a talking topic in the coroutines ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found