Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buffer is full, dropping message in #74

Closed
nefingar opened this issue Jun 19, 2019 · 8 comments
Closed

Buffer is full, dropping message in #74

nefingar opened this issue Jun 19, 2019 · 8 comments
Labels
bug Something isn't working

Comments

@nefingar
Copy link

At the moment I'm not able to receive any messages with the bridge but sending one isn't a problem at all.

The error message i found inside the log file was:
[Jun 19, 2019 23:25:15] [User/***************/WARN] Buffer is full, dropping message in **************@s.whatsapp.net

I tried reconnecting, creating a new web whatsapp session and also restarting the whole bridge but I'm still getting the same error message.

@nefingar
Copy link
Author

After a day or so, the bridge started to work normally again and the warning wasn't posted again in my log files. I think an automated restart of the bridge has fixed my issue, but I'm not completely sure, since restarting it manually hasn't made any difference.

@erdnaxeli
Copy link

I had the same issue, but rebooting the bridge was enough. I'm wondering what is the cause here. The bridge being unable to talk to the HS?

@vmario89
Copy link

hi. have the same problem with "buffer is full" after 1~2 days as it seems. restarts works

@nefingar
Copy link
Author

I can confirm that. I encountered the error once more and by killing the process and starting it again the bridge starts syncing all chats again.

@olmari
Copy link
Contributor

olmari commented Jun 25, 2019

Can confirm too, it seems that when this condition occurs, I get buffer full warning somewhat every time I should get incoming message. At the logs I see connection timeouts etc similars happening at timestamps after buffer full thing is going on, but nothing helps but restart of bridge-service.

@tulir tulir added the bug Something isn't working label Jun 26, 2019
@thomersch
Copy link

Based on a quick look it seems that there are some systematic problems in the code structure. E.g. user.putMessage will throw the mentioned "Buffer is full" when getting back pressure from handleMessageLoop, which unnecessarily uses a mutex in order to write on a chan, which should never be necessary in Go. After all channels are the method which should substitute locking.

I would be happy to help with any effort to rewrite the code to use less mutexes.

@tulir
Copy link
Member

tulir commented Aug 10, 2019

The mutex isn't for locking the write on a chan, it's locking the processing of incoming messages. That locking is needed so that incoming messages wouldn't be handled while the bridge is backfilling after connecting, since handling those newer messages first would prevent backfilling.

@tulir
Copy link
Member

tulir commented Aug 26, 2020

This shouldn't be a problem for most users anymore. Some people with very big accounts might need to adjust the buffer config, but the defaults should be fine for most users.

I also switched the handleMessageLoop to use a channel and WaitGroup instead of a mutex for the channel, which should look less weird and might even be more performant.

@tulir tulir closed this as completed Aug 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

6 participants