Skip to content
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

jsaddle-warp does not seem to handle multiple clients well #57

Closed
eskimor opened this issue Mar 1, 2018 · 3 comments
Closed

jsaddle-warp does not seem to handle multiple clients well #57

eskimor opened this issue Mar 1, 2018 · 3 comments

Comments

@eskimor
Copy link

eskimor commented Mar 1, 2018

It seems that jsaddle-warp does not properly handle multiple browser connections well. It seems that they get mixed somehow. I just had the issue, that one private tab requested data from the server and it showed up in the GUI of the other tab, when I closed the private tab. (It did not show up in the private tab at all).

Also when tracing what gets sent to the server it seems that data gets mixed. Can this be the case? Is jsaddle-warp designed to handle multiple connections well?

@hamishmack
Copy link
Member

It should work. Do you have a test case that we can use to reproduce the issue? Was the server just plane JSaddle (or have you added servant or anything else to it)? Was it using the JSaddle debug function? What other libraries were being used?

One thing that might cause problems is if JSaddle, other libraries or your app are using unsafePerformIO to create singletons. JSaddle does use this trick, but only in places it should be safe. For instance it has jsNull = JSVal . unsafePerformIO $ newIORef 0. This should be ok because the IORef inside any JSVal should be immutable (it is an IORef so we can attach finalisers for the JSVals that need to be freed on the JavaScript side).

@eskimor
Copy link
Author

eskimor commented Mar 1, 2018

Thank you for this very quick response. I have a test case, but it is far from minimal, I will try to provide a minimal one and will prepare and post instructions for the not so minimal case in the meantime.

I was not using the JSaddle 'debug' function. Other libraries used:

aeson
attoparsec
base64-bytestring
bytestring
Cabal
containers
data-default
directory
errors
filepath
generic-deriving
ghcjs-dom
gonimo-common
http-types
jsaddle
jsaddle-dom
jsaddle-warp
lens
lifted-base
mtl
reflex
reflex-dom
reflex-dom-core
safe
text
time
transformers
transformers-base
wai-middleware-static
warp
websockets

At least my code does not make any use of unsafePerformIO.

Servant was not added, just a middleware serving static files, code is here.

@eskimor
Copy link
Author

eskimor commented Mar 10, 2018

Ok, I am no longer able to reproduce this issue. Really weird, maybe my system just needed a reboot.

@eskimor eskimor closed this as completed Mar 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants