On 09/30/2016 12:22 AM, Super Twang wrote: > I'm hoping someone familiar with libuv, and its use with websockets can > help me out. I've run into a really confusing problem... > > I've implemented a http/websockets server in C++ using libuv. > > I've got json successfully being sent and received in both directions > client->server and server->client (asyncronously -- single threading > server). The client is a browser, either mobile or desktop. > > The json messaging almost always works fine on my developer machine > (recent MacBook Pro), BUT > on my client's much older windows laptop, running Chrome, and every once > in a blue moon on my dev machine, the server is receiving garbage when > the browser tries to send any largeish-chunk of json (ballpark 2 > single-spaced, pretty-printed pages -- not really -that- large!). > Needless to say, this wreaks havoc on the app as it misses key messages > like "Save" and such. > > Why would the libuv/websockets transport work with a newer machine, but > not with an older one? Could network congestion be playing a part? How > could I work around it, if so? > > Is there some limit to javascipt client sending size I need to pay > attention to, or somehow tune? > > Should I set up a javascript chunking function and send large messages > in parts? I thought the transport layer was supposed to handle this, > but it doesn't seem to be. > > This has been a very difficult problem to track down, since it is only > happening once I deliver a release. To make things worse, I have no > window into the app, when the client runs it remotely, since it is meant > to run on a private wifi network. I have been able to capture logs a > couple of times, however, when he runs it on the live internet, but they > only show incoming garbage. Well, to be fair, several lines of good > message, followed by lots of garbage -- usually the same junk character > repeated many times. > > Can anyone suggest what might be going on here, and how to approach > solving it? >
Hi, It's hard to guess what could be going on, but I'll take a guess :-) If the data you receive is "garbage", it could be freed memory. Are you reusing read buffers? If you can reproduce it locally, I suggest you run it under Valgrind to catch some potential use-after-free cases. Alternatively, you could replace the libuv allocator with one which poisons the memory before freeing it, that way you would see familiar values here or there, suggesting where the problem is. Cheers, -- Saúl Ibarra Corretgé bettercallsaghul.com -- You received this message because you are subscribed to the Google Groups "libuv" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/libuv. For more options, visit https://groups.google.com/d/optout.
signature.asc
Description: OpenPGP digital signature
