osc icon indicating copy to clipboard operation
osc copied to clipboard

Loosing messages when using > 1 worker

Open avlapp opened this issue 3 years ago • 2 comments

func (conn *UDPConn) Serve(numWorkers int, dispatcher Dispatcher) error

When I set 8 workers instead of just 1, it seems I'm loosing message now and then. A list is returned and sometimes it doesn't have the right length. It didn't occur yet, when I've just 1 worker running. Will keep an eye on it, while using 1 worker.

edit: looks like a channel doesn't get drained properly, cause when it goes wrong, the list is one to short or one to long.

avlapp avatar Oct 23 '22 14:10 avlapp

My current take is that it might not be a bug in scgolang/osc. Using multiple workers is possibly just making the order of delivery of the packages less reliable. UDP doesn't guarantee order of delivery I think and using multiple goroutines probably makes it worse. The list of messages I'm getting ends with a 'end sign', but it's probably delivered before the last item/msg in the list is send. TCP or using timestamps might solve this in the particular application.

avlapp avatar Oct 24 '22 08:10 avlapp

If I understand the followings comments right, the review of this patch isn't that positive: https://github.com/scgolang/osc/pull/3

If this issue is true (problem could be on my side) and these patch comments are rightly interpreted, one could ask if it's worth the extra complexity of workers here. In general you want to keep the order of osc messages as it is I think (unless you use timestamps probably).

Needs investigation.

vlappa avatar Sep 01 '23 08:09 vlappa