Closed leolorenzoluis closed 2 years ago
Same
I'm thinking that the Elmish ring buffer is not friendly when using multiple threads. I'll check the issues with it and probably revert it to using a MailboxProcessor again.
Do you know when you are planning to do this? Do you need any help? I'm not familiar with the code-base, but who knows maybe I can help with anything.
A minimal repro code for the issue would be excellent. I tried to look at it earlier today, but only the stack trace didn't give me much information to understand the problem's root cause.
For sure.
hub.SendClientIf(fun client -> client.id = id)
hub.SendClientIf(fun client -> client.id = id)
hub.SendClientIf(fun client -> client.id = id)
throws exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at Elmish.RingBuffer`1.Pop()
at Elmish.ProgramModule.dispatch@140.Invoke(msg msg)
at Microsoft.FSharp.Core.OptionModule.Iterate[T](FSharpFunc`2 action, FSharpOption`1 option) in D:\a\_work\1\s\src\fsharp\FSharp.Core\option.fs:line 50
at Server.broadcastToSubscribers@23-1.Invoke(a arg10)
at Server.subscriberClientMsgFn(SubscriberId sId, ServerToClientMessage yieldedMsg) in C:\Users\.....\Server.fs:line 30```
I'm uploading version 6.0.3, which uses a MailboxProcessor to control the access to the Elmish dispatcher, hopefully fixing the problem with multi-threading.
Thank you! Will give it a try.
Seems to be working. Thank you again, for the prompt fix!
I receive the following error when I push a lot of messages in multiple threads. Any guidance what it could mean? It works fine for few background threads and then it dies