GithubHelp home page GithubHelp logo

hyperia's People

Contributors

lithdew avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

oxyo

hyperia's Issues

Fix auto-reconnection not being triggered sometimes in the TCP client example.

There is an edge case in the TCP client example.

Suppose all connections in the pool are spawned and connected to a TCP server on 127.0.0.1:9000.

The TCP server closes.

All but one connection should be released, and that one connection left should attempt to auto-reconnect to 127.0.0.1:9000 up to 10 times. No new connections should be spawned until the one connection left in the pool either successfully reconnects or fails all auto-reconnection attempts. When either the one connection left completely fails all reconnection attempts or succeeds, it resumes all coroutines attempting to push messages into the client to be written to 127.0.0.1:9000 (if there are any).

However, suppose the one connection left that is responsible for auto-reconnecting erroneously manages to successfully connect to 127.0.0.1:9000 because of a race condition. A race condition where in spite of the fact that 127.0.0.1:9000 is no longer reachable, the connection succeeds (this actually can happen based on fuzzing tests I have made).

Because of the way pooling works, the one connection reports that 127.0.0.1:9000 is reachable, and the coroutines resumed may additionally spawn new connections that are then registered into the pool that'll attempt to connect (but fail to connect) to 127.0.0.1:9000.

The connection that erroneously succeeded in connecting to 127.0.0.1:9000 then gets dropped because the TCP stack realizes it actually is unreachable, all other accidentally-spawned connections get dropped as well, and auto-reconnection does not get triggered.

The expected behavior is that auto-reconnection should happen in spite of this single edge case. The actual behavior is that auto-reconnection does not get triggered given this edge case.

[lith@dew:~/Desktop/hyperia]$ zig build example_tcp_client
info(client): Connection@10ba050 got spawned
info(client): Connection@10ba050 successfully connected
info(client): Connection@7f00ac000b60 got spawned
info(client): Connection@7f00ac000b60 successfully connected
info(client): Connection@7f00ac0020e0 got spawned
info(client): Connection@7f00ac0020e0 successfully connected
info(client): Connection@7f00ac003660 got spawned
info(client): Connection@7f00ac003660 successfully connected
info(client): Connection@7f00ac003660 write loop ended
info(client): Connection@10ba050 read loop ended
info(client): Connection@7f00ac000b60 read loop ended
info(client): Connection@7f00ac0020e0 read loop ended
info(client): Connection@7f00ac003660 read loop ended
info(client): Connection@7f00ac003660 disconnected
info(client): connection Connection@7f00ac003660 was released
info(client): Connection@7f00ac0020e0 write loop ended
info(client): Connection@7f00ac0020e0 disconnected
info(client): connection Connection@7f00ac0020e0 was released
info(client): Connection@7f00ac000b60 write loop ended
info(client): Connection@7f00ac000b60 disconnected
info(client): connection Connection@7f00ac000b60 was released
info(client): Connection@10ba050 write loop ended
info(client): Connection@10ba050 disconnected
info(client): Connection@10ba050 reconnection attempt 1
info(client): Connection@10ba050 successfully connected
info(client): Connection@10ba050 write loop ended
info(client): Connection@7f00ac000b60 got spawned
info(client): Connection@7f00ac0020e0 got spawned
info(client): Connection@7f00ac003660 got spawned
info(client): Connection@7f00ac003660 got an error while connecting: error.ConnectionRefused
info(client): connection Connection@7f00ac003660 was released
info(client): Connection@7f00ac003660 got spawned
info(client): Connection@7f00ac003660 got an error while connecting: error.ConnectionRefused
info(client): connection Connection@7f00ac003660 was released
info(client): Connection@10ba050 read loop ended
info(client): Connection@10ba050 disconnected
info(client): connection Connection@10ba050 was released
info(client): Connection@7f00ac000b60 got an error while connecting: error.ConnectionRefused
info(client): connection Connection@7f00ac000b60 was released
info(client): Connection@7f00ac0020e0 got an error while connecting: error.ConnectionRefused
info(client): connection Connection@7f00ac0020e0 was released
^Cinfo(client): got ctrl+c
info(client): done
info(client): good bye!

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.