ttybus icon indicating copy to clipboard operation
ttybus copied to clipboard

ttybus losing some bytes

Open leoheck opened this issue 1 year ago • 3 comments

I think I understood what was going on with my application. The tty_mux socket might be filling its buffer after some time, and then things do not work well anymore.

Found out that the BUFFER_SIZE is 4096. image

ttybus currently doesn't have a way to change this value from the command line, but I am not sure yet if increasing it will make any difference since my app will be running for a long time and the issue will eventually happen again

Do you have a suggestion for what I could do in this case?

I started my issue here, https://github.com/danielinux/ttybus/issues/14#issuecomment-1805713933. Well, I am opening a new issue instead of hijacking the other one.

leoheck avatar Nov 12 '23 13:11 leoheck

Found this:

➜ ls -ltr /dev/ttyGNSS*    
srwxrwxrwx 1 root root  0 Nov 12 11:17 /dev/ttyGNSS_mux
lrwxrwxrwx 1 root root 10 Nov 12 11:17 /dev/ttyGNSS_fake_a.bak -> /dev/pts/0
lrwxrwxrwx 1 root root 10 Nov 12 11:17 /dev/ttyGNSS_fake_b -> /dev/pts/1
lrwxrwxrwx 1 root root 10 Nov 12 19:15 /dev/ttyGNSS_fake_a -> /dev/pts/1 <== this should not be /1

As I could understand, my main service that creates the /dev/ttyGNSS_mux and also the ones that create /dev/ttyGNSS_fake_a and /dev/ttyGNSS_fake_b started fine at 11h17.

For some reason, the service that creates /dev/ttyGNSS_fake_a had to restart and then ended up using the same device (/dev/pts/1) that /dev/ttyGNSS_fake_a was already using.

I am not sure if this is caused by the way I use ttybus, but I am sharing this here to follow the discussions.

I am using it this way:

# Service 1
tty_bus -d -s /dev/ttyGNSS_mux
tty_attach -s /dev/ttyGNSS_mux /dev/ttyUSB0

# Sevice 2
tty_fake -o -s /dev/ttyGNSS_mux /dev/ttyGNSS_fake_a &

# Sevice 3
tty_fake -o -s /dev/ttyGNSS_mux /dev/ttyGNSS_fake_b &

leoheck avatar Nov 13 '23 12:11 leoheck

I was using the flag -o on tty_fake is it possible that this flag is causing this issue?

leoheck avatar Nov 13 '23 14:11 leoheck

Removing this -o definitely improved.y system since there is no duplicated devices being created. But I still have issues after a couple of ours with the bytes being lose.

Is there any way to monitor the created socket? I could not find any tool for that, just the ss but os doesn't show anything that helps me here.

leoheck avatar Nov 14 '23 17:11 leoheck