Giter Club home page Giter Club logo

Comments (13)

vtortola avatar vtortola commented on August 16, 2024

Thanks for taking time in reporting this. I will take a look 👍

from websocketlistener.

vtortola avatar vtortola commented on August 16, 2024

I will include a fix for this next week together with other small changes.

from websocketlistener.

vtortola avatar vtortola commented on August 16, 2024

Did you by chance catch the actual exception that is thrown at the constructor? (not the one that was caught by the GC).

from websocketlistener.

jacobs100500 avatar jacobs100500 commented on August 16, 2024

An exception in the constructor is caught ok. This my code for test:

public WebSocketRfc6455(Stream clientStream ... ) :base(httpRequest, httpResponse)
{
    throw new Exception("Test");

    if (clientStream == null)
        throw new ArgumentNullException("clientStream");
    ...
}

After starting WebSocketListener, called GC.

WebSocketListener listner = new WebSocketListener(endPoint, options);
...
listner.Start();

Console.ReadKey();
GC.Collect();

When a client connects, the "Test" exception is thrown, and the connection is closing (closing clientStream, but class WebSocketRfc6455 not dispose). Then i press Enter and triggered GC. GC tries to dispose class WebSocketRfc6455, and throwns the exception System.NullReferenceException: Object reference not set to an instance of an object

from websocketlistener.

vtortola avatar vtortola commented on August 16, 2024

What I mean is if you caught the original exception that was thrown in the constructor when you discovered this issue first? I am interested in knowing what failed in the constructor that time.

from websocketlistener.

jacobs100500 avatar jacobs100500 commented on August 16, 2024

Unfortunately, I do not know what happened at that time. The logs record only preserved this exception.

from websocketlistener.

vtortola avatar vtortola commented on August 16, 2024

I believe it has been fixed in: cae9c5e

If you have the chance to get latest source and try it would be great :)

Cheers.

from websocketlistener.

jacobs100500 avatar jacobs100500 commented on August 16, 2024

I upgrade my source. Error is not occurred :) But I will still keep an eye.

I have long since found the problem, but I do not know this is a problem in the code or incorrect data.

First. Thrown the exception "Cannot parse cookie string". Cookie data: _ym_isad=2; __test; settings=...
because: The 'Name'='__test; settings' part of the cookie is invalid.

Second. In some websocket frames lacks one byte. I don't have a raw data now. If necessary, i will get later. This problem occurs when you don't use deflate compression.

from websocketlistener.

vtortola avatar vtortola commented on August 16, 2024

Sent frames always lack one byte, the final one, that is sent when you close the stream. Deflate frames are different because they are flushed with the DeflateStream as far as I remember.

I can replicate the cookie issue. It was happening before as well. I will put a fix for that today.

from websocketlistener.

jacobs100500 avatar jacobs100500 commented on August 16, 2024

It's problem with incoming frames. For example, server receives json data without last symbol "}".

Full exception message:
Cannot parse cookie string: 'language=ru; _ym_uid=1459682501809792379; _ym_isad=2; __test; settings=%7B%22market_730_onPage%22%3A24%7D; timezoneOffset=10800' because: The 'Name'='__test; settings' part of the cookie is invalid.

These are not my cookies. I don't remember what browser, but is real device (not bot). Also I can keep track of this information.

from websocketlistener.

vtortola avatar vtortola commented on August 16, 2024

Fixed the cookie thing: 616f257

I am going to review my latest changes to see if I cannot spot that problem you say about missing frames. If you come across a reproducible case let me know.

from websocketlistener.

vtortola avatar vtortola commented on August 16, 2024

I have been running a small stress test that creates random JSON objects with random numbers of properties and random values against an echo service with WebSocketListener, and I always get echoed the right object, with both ws:// and wss://

https://gist.github.com/vtortola/eead57d64bf4645c7e91176e2977d920

I think ClientWebSocket does not use compression, but the tests I have made with the browser always run fine. Keep an eye on it, I would be very interested in finding out what could go wrong, but also review your own code you may have something fishy.

Cheers.

from websocketlistener.

jacobs100500 avatar jacobs100500 commented on August 16, 2024

I found an old log with a description of the error.

Message 1 (Pong frame):
Bytes: 8A814FBBE841
Sec-WebSocket-Version: 13
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits

Message 2 (Text frame):
Bytes: 81E935146C9C052517BE466009FD584B05F8172E5BAA00225DAD0C2C5DAE00265DA800265CB0176005F1503656AD01215FAE07215CAB07384EF4546704BE0F363EED637830B3425C04F1547E3FD353401ED0634E0FDD7B5236F7637D2BCA047A58C4504636C9477129AE567B51BE
Sec-WebSocket-Version: 13
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits

This client had a browser Google Chrome of the latest version (the latest version on January 2016)

from websocketlistener.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.