Fork me on GitHub
#yada
<
2017-04-22
>
bbss05:04:10

I'm getting situations where the yada server stops responding, in order to send cljs figwheel app and request to the same origin I have an endpoint that hosts the static files, but that stops responding too. I don't know how to debug a running yada instance. I suspect one of the endpoints' buffers gets full. I have a few normal endpoints and one that sends datascript transactions via SSE using s/connect to a bus topic (this is awesome by the way). But now I can't figure out where it goes wrong.

dominicm07:04:14

@bbss Just a hunch from a few weeks ago, if you curl to yada after it has locked up, does the same thing happen?

malcolmsparks07:04:23

Are you using a reloaded workflow and resetting, or is the in prod?

malcolmsparks07:04:35

If you're using a manofold @bbss are you certain you are shutting everything down and not leaving anything lingering across resets?

bbss07:04:09

@dominicm will try when it happens again.

bbss07:04:54

@malcolmsparks I am just starting manually using cider

(def server (yada/listener (routes) {:port 3000}))

#_((:close server))

dominicm07:04:34

@bbss Then doing a cider refresh as you update your code? or an eval of new code?

bbss07:04:37

It could be that the bus that I store in an atom causes some problems? How would I know?

bbss07:04:51

I just eval close and eval server again

bbss07:04:16

I can paste the code, it's not very verbose, just a naïve sync to everyone interested in one datascript db.

bbss07:04:32

It's been wonderful to work with so far. Really cool to prototype with and I hope I can eventually use it in production when I make something useful.

bbss07:04:44

And then eventually switch to datomic on the back-end.

malcolmsparks07:04:46

My thoughts are that perhaps closing the aleph server doesn't cause everything to be cleaned up, so there is some resource leakage eventually causing everything to lock up

malcolmsparks08:04:10

But if you are storing a single bus in an atom that leads me to suspect that is not the problem. Unless you are ever re-requring the namespace containing that atom

malcolmsparks08:04:28

Are you using defonce for the atom?

bbss08:04:59

Yes I am using defonce. It's in the same namespace currently.

malcolmsparks08:04:01

I'm a bit stumped. How quickly does the lock up manifest itself?

bbss08:04:02

I have tried resetting the atom (reset state {}) but that didn't seem to affect it.

bbss08:04:47

Hmm, it occurred after a couple hours of hacking. Only a couple times so far.

dominicm08:04:01

Could those manifold.stream/connect's not be shutting down?

bbss08:04:35

I don't have the issue now but I think the thing @dominicm was referring to is the browser having limits on open requests maybe. Which is a valid concern as when I close the server a ton of open subscriptions fail.

malcolmsparks08:04:53

That's my thoughts. Could be to do with manifold streams

bbss08:04:04

But refreshing the browser didn't work and I think I tried a different browser too.

malcolmsparks08:04:12

Right. Always check with curl

malcolmsparks08:04:35

Browsers limit sse connections to the same origin to 4

bbss08:04:41

Will do next time. I also figured it might be how yada handles the connected stream.

bbss08:04:37

Ah, good to know. Let me check, it might have been triggered by opening too many different subs.

bbss08:04:39

Yes! I think that might have been it!

bbss08:04:21

Thanks, I think that was it. Keeping an eye out and trying curl first next time.

bbss08:04:12

IF there's a next time of course 😄

malcolmsparks08:04:21

Great to hear. Yada shares a lot of infrastructure with Netty, and a huge benefit is that when things go wrong it is usually in user-space.

malcolmsparks08:04:04

Manifold is awesome but you have to be careful to tidy up

malcolmsparks08:04:16

The way manifold is designed gives you the control, which is the right design in my view

bbss08:04:14

Yes, I do feel like I am building on solid fundamentals. Manifold looks like a good choice for scaling. But yeah, I do need to figure out how to not get a memory leak somewhere or something like that. Not sure yet how to do that and how I will find out. I know storing this somewhat ephemeral bus in an atom is probably not the way to go.

bbss08:04:16

periodic cleaning up of the buses with no downstream consumers seems like something I'll need to do.

malcolmsparks08:04:56

The best advice I can give is to keep things simple and reason about your design, thinking about it until you properly understand what is going on. Take some time to draw pictures or diagrams on scrap paper if that helps.

lmergen18:04:31

ah ive been waiting for that one, thanks for the release!

malcolmsparks18:04:20

Let me know how it works out @lmergen !