hogosuru icon indicating copy to clipboard operation
hogosuru copied to clipboard

go-language-fatal-error-all-goroutines-are-asleep-deadlock

Open idevorel opened this issue 2 years ago • 6 comments

https://github.com/realPy/hogosuru/blob/ee8533a3b579978e160160fd61859aa80b6c1e89/promise/promise.go#L249

use with wg.Wait() no channels or select {} https://stackoverflow.com/questions/26927479/go-language-fatal-error-all-goroutines-are-asleep-deadlock

idevorel avatar Jun 23 '22 22:06 idevorel

that's not the root of the problem at all. The concern is that channels in general shouldn't be used in webassembly because it's not true parallel processing. So he should prefer the use of promises instead. For me this is not an issue but a javascript stack constraint. This is a specific case of using go in webassembly. Are you affected by this problem? If your read the code of wg.Wait you can see it use semaphore and it will deadlock too in this specific situation.

realPy avatar Jun 24 '22 05:06 realPy

I suggested to read the doc here https://hogosuru.v-ip.fr/guides/async-work-with-promise I explain the "thread mechanical" of js, some schema and how to sync with promise. My advice: In webassembly never use go channel except for the last line of "inifinite" waiting of code need by a wasm.

realPy avatar Jun 24 '22 06:06 realPy

I don't know why or how , but i get error and my app crash , with waiting with "channels" or "select{}". just wg.Wait() work well for me.

idevorel avatar Jun 24 '22 10:06 idevorel

And you are using Await?

realPy avatar Jun 24 '22 10:06 realPy

yes

idevorel avatar Jun 26 '22 06:06 idevorel

You can make a pr if you want. I will integrate it. This func is here for backward compatibilities and should be deprecated

realPy avatar Jun 26 '22 10:06 realPy