Commit graph

203 commits

Author SHA1 Message Date
DataHoarder 6aa55619ee
Replace go.mod path with git.gammaspectra.live/P2Pool/zmq4 2024-04-14 10:10:36 +02:00
DataHoarder a35fa84ca9
Remove golang.org/x/text dependency by using deprecated strings.Title 2024-04-13 00:17:49 +02:00
DataHoarder 7f7d531f58
Update dependencies 2024-04-07 17:37:47 +02:00
DataHoarder 6f01655832
Remove unnecessary github.com/go-zeromq/goczmq/v4 dependency 2024-04-07 17:36:11 +02:00
Sergey Egorov e75c615ba1
zmq4: fix another connection reaper deadlock
Fixes #149

Co-authored-by: Sergey Egorov <sergey.egorov@teleste.com>
Co-authored-by: Sebastien Binet <binet@cern.ch>
2024-01-24 09:59:09 +01:00
Sergey Egorov 16ca7c091b
zmq4: add timeout support on send
Add internal/errgroup package to support cancellable error groups.

Fixes #147.

Authored-by: Sergey Egorov <sergey.egorov@teleste.com>
2023-12-15 09:37:49 +01:00
Sebastien Binet e16dc3e41e all: bump x/sync@v0.1.0 and x/text@v0.13.0
Signed-off-by: Sebastien Binet <binet@cern.ch>
2023-09-14 09:43:06 +02:00
Sebastien Binet df7914005c all: drop Go-1.19, add Go-1.21
Signed-off-by: Sebastien Binet <binet@cern.ch>
2023-09-14 09:41:21 +02:00
Dávid Németh Cs 683c549a24
zmq4: fix race condition in Rep cancellation
* There is a race condition in repWriter write(ctx context.Context, msg Msg):

if the run() loop of repWriter has exited because r.ctx was cancelled then <- repSendPayload will block, because nobody is reading the channel anymore

I'm adding a test that reproduces the issue with a fix.

* We should also abort when the writer context is cancelled.
2023-09-14 09:39:27 +02:00
Sebastien Binet bd7e8713a9 ci: update actions/setup-go@v4, codecov/codecov-action@v3
Signed-off-by: Sebastien Binet <binet@cern.ch>
2023-04-11 10:14:15 +02:00
SuperFashi 72ac04fc38
zmq4: deal with empty identity for ROUTER sockets
Co-authored-by: Ziyan <ziyan.zhou@mujin.co.jp>
2023-04-11 09:46:27 +02:00
Sebastien Binet 1d9bdfe427 ci: bump staticcheck-ci@v2023.1
Signed-off-by: Sebastien Binet <binet@cern.ch>
2023-04-07 11:11:43 +02:00
Sebastien Binet ea2d2e39fa all: bump to Go-1.19
Signed-off-by: Sebastien Binet <binet@cern.ch>
2023-03-29 11:28:29 +02:00
Sebastien Binet 14348e2ca2 all: bump x/sync, x/text
Signed-off-by: Sebastien Binet <binet@cern.ch>
2023-03-29 11:27:45 +02:00
Bartek Pacia 2ae93282dd
ci: streamline github actions
Co-authored-by: Sebastien Binet <binet@cern.ch>
2022-11-09 11:01:48 +01:00
Bartek Pacia 71973597eb
zmq4: minor docs improvement and clarification 2022-11-06 10:31:44 +01:00
Sebastien Binet 217f26c4a3 zmq4: add UnknownTransportError
Signed-off-by: Sebastien Binet <binet@cern.ch>
2022-06-21 11:56:56 +02:00
Sebastien Binet 7b8877afcd ci: remove last remnants of Travis-CI
Signed-off-by: Sebastien Binet <binet@cern.ch>
2022-06-21 11:55:44 +02:00
thielepaul 2b7cf285e4
zmq4: add option for automatic reconnect 2022-06-21 10:35:19 +02:00
thielepaul ae18bc07fd
zmq4: make number of retries for dial configurable 2022-06-20 10:04:53 +02:00
Sebastien Binet 04c84de768 zmq4: disable inproc-crouter-cdealer
Signed-off-by: Sebastien Binet <binet@cern.ch>
2022-06-17 12:10:39 +02:00
Paul Thiele c17962e2ad zmq4: resend subscriptions in socket.addConn 2022-06-17 09:07:37 +02:00
Sebastien Binet 16d169c4c0 all: bump x/sync
Signed-off-by: Sebastien Binet <binet@cern.ch>
2022-06-02 09:30:41 +02:00
Sebastien Binet 5018dabe7f ci: update actions/{setup-go,checkout,cache}@v3
Signed-off-by: Sebastien Binet <binet@cern.ch>
2022-06-02 09:27:32 +02:00
Sebastien Binet 0c42e29fa8 example: add go:build directives
Signed-off-by: Sebastien Binet <binet@cern.ch>
2022-06-02 09:15:06 +02:00
Sebastien Binet f15d539071 all: rename master into main
Signed-off-by: Sebastien Binet <binet@cern.ch>
2022-06-02 09:14:03 +02:00
Sebastien Binet a98fd8f576 zmq4: fix last remaining io/ioutil use
Signed-off-by: Sebastien Binet <binet@cern.ch>
2022-06-02 09:12:31 +02:00
Issac Trotts ae3a4cef5c
example: add hello client/server
Derived from https://zguide.zeromq.org/docs/chapter1
2022-06-02 09:10:41 +02:00
Sebastien Binet a618f64423 all: bump x/sync@2022051321
Signed-off-by: Sebastien Binet <binet@cern.ch>
2022-06-01 09:26:29 +02:00
Sebastien Binet e634baf52b all: apply gofmt
Signed-off-by: Sebastien Binet <binet@cern.ch>
2022-06-01 09:25:53 +02:00
Sebastien Binet 9fa22f043c all: add go:build directives
Signed-off-by: Sebastien Binet <binet@cern.ch>
2022-06-01 09:25:53 +02:00
Sebastien Binet 7c2b75a823 all: drop Go-1.16, add Go-1.18
Signed-off-by: Sebastien Binet <binet@cern.ch>
2022-06-01 09:24:13 +02:00
Sebastien Binet fcd2edd714 ci: drop golangci-lint, use staticcheck
Signed-off-by: Sebastien Binet <binet@cern.ch>
2022-06-01 09:23:20 +02:00
Sebastien Binet ec04dfaed4 all: apply staticcheck fixes
Signed-off-by: Sebastien Binet <binet@cern.ch>
2022-06-01 09:22:12 +02:00
Sergey Egorov b7c2c56a23
zmq4: fix REP socket races on client connection
Fixes #119.

Co-authored-by: Sergey Egorov <sergey.egorov@teleste.com>
2022-01-29 18:16:16 +01:00
Sebastien Binet a8dffa516d all: bump x/sync
Signed-off-by: Sebastien Binet <binet@cern.ch>
2022-01-25 11:47:34 +01:00
Dewei Chen d200121ffd
zmq4: add context to semaphore lock
This change adds context to the semaphore.lock method so that read can be
unblocked when the context is canceled, instead of resulting in a deadlock.
2021-11-10 09:56:25 +01:00
Sebastien Binet 2435d9806c ci: update go-cache 2021-09-28 10:12:58 +02:00
Sebastien Binet fda4fcd2f2 ci: bump Go-1.17 2021-09-28 10:10:25 +02:00
Sebastien Binet 7ab29a1c38
all: add mention about maintenance 2021-08-28 16:12:37 +02:00
Jordan Carlson 6fb93424d0
zmq4: ensure reaperCond is unlocked when context is canceled 2021-06-09 09:54:21 +02:00
Jordan Carlson 03db79de94
zmq4: fix router race/deadlock when multiple clients disconnect
This CL fixes a rare race condition that occurs when multiple clients
disconnect from a router socket in rapid succession, which results in a deadlock.

The lock under contention is routerMWriter.mu, which is taken in
routerMWriter.write() as part of a Socket.Send() call. What happens is that
the write fails and it tries to call socket.scheduleRmConn() to remove the failed
Conn (while still holding the lock). But scheduleRmConn() can't proceed because
the socket.closedConns channel is full, and the connReaper goroutine is stuck
trying to acquire the same lock via routerMWriter.rmConn.

The first commit here provides a test case that deadlocks reliably on my machine.
(The stack trace is messy because it includes noise from the client sockets, the
problem is much easier to see when the clients run as a separate process.)

The proposed fix just changes closedConns from a (fixed-capacity) channel into
an (arbitrary-sized) slice, managed by a sync.Cond.

Conceptually, instead of using an unbuffered channel for `closedConns`
(or a channel with any finite capacity), we use a mutex and condvar to
manage an arbitrary-sized list of closed connections.
2021-05-20 09:52:16 +02:00
Sebastien Binet eb5f9b0cdc ci: bump Go-1.16
Signed-off-by: Sebastien Binet <binet@cern.ch>
2021-05-05 11:35:57 +02:00
Guido Goldstein b4a071bea5 zmq4: do not drop frames in req/rep sockets
Fixes #99

Co-authored-by: Guido Goldstein <git@a-nugget.de>
Co-authored-by: Sebastien Binet <binet@cern.ch>
2020-12-04 11:04:18 +01:00
Sebastien Binet 326ab9407f doc: remove Travis-CI badge 2020-12-04 10:27:35 +01:00
Sebastien Binet 4c901c2d07 ci: update golangci-lint 2020-12-04 10:22:50 +01:00
Sebastien Binet c6d400bb32 all: add badges 2020-10-23 10:32:35 +02:00
Sebastien Binet b5d7e58d94 all: apply golint fixes 2020-10-21 16:12:23 +02:00
Sebastien Binet 14db8f5738 zmq4: remove load-balanced writer 2020-10-21 15:55:37 +02:00
Sebastien Binet 1cd64173ee ci: add golangci-lint action 2020-10-21 15:40:52 +02:00