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

WhatsApp closing the connection is not handled correctly #21

Closed
Half-Shot opened this issue Dec 1, 2018 · 7 comments
Closed

WhatsApp closing the connection is not handled correctly #21

Half-Shot opened this issue Dec 1, 2018 · 7 comments
Labels
bug Something isn't working

Comments

@Half-Shot
Copy link
Contributor

[Dec  1, 2018 23:26:52] [User/@Half-Shot:half-shot.uk/ERROR] WhatsApp error: unexpected websocket close: websocket: close 1000 (normal)
[Dec  1, 2018 23:26:53] [User/@Half-Shot:half-shot.uk/ERROR] WhatsApp error: unexpected websocket close: websocket: close 1000 (normal)
[Dec  1, 2018 23:26:54] [User/@Half-Shot:half-shot.uk/ERROR] WhatsApp error: unexpected websocket close: websocket: close 1000 (normal)
[Dec  1, 2018 23:26:55] [User/@Half-Shot:half-shot.uk/ERROR] WhatsApp error: unexpected websocket close: websocket: close 1000 (normal)
[Dec  1, 2018 23:26:56] [User/@Half-Shot:half-shot.uk/ERROR] WhatsApp error: unexpected websocket close: websocket: close 1000 (normal)
[Dec  1, 2018 23:26:57] [User/@Half-Shot:half-shot.uk/ERROR] WhatsApp error: unexpected websocket close: websocket: close 1000 (normal)
[Dec  1, 2018 23:26:58] [User/@Half-Shot:half-shot.uk/ERROR] WhatsApp error: unexpected websocket close: websocket: close 1000 (normal)
[Dec  1, 2018 23:26:59] [User/@Half-Shot:half-shot.uk/ERROR] WhatsApp error: unexpected websocket close: websocket: close 1000 (normal)
[Dec  1, 2018 23:27:00] [User/@Half-Shot:half-shot.uk/ERROR] WhatsApp error: unexpected websocket close: websocket: close 1000 (normal)
@jdreichmann
Copy link

Can confirm, i had this aswell. After checking again, it stopped after 5min after the logs began. Using it via default configs in matrix-docker-ansible-deploy.

@tulir tulir changed the title unexpected websocket close: websocket: close 1000 (normal) spam in my term WhatsApp closing the connection is not handled correctly Jan 14, 2019
@tulir tulir added the bug Something isn't working label Jan 14, 2019
@rreuvekamp
Copy link
Contributor

rreuvekamp commented Feb 13, 2019

This seems to be a problem upstream: https://github.com/Rhymen/go-whatsapp/blob/c9a81e9578840e5c04c49c9e6126a1682faf22fc/conn.go#L276

There is an issue for it as well: Rhymen/go-whatsapp#98

It seems that, at the moment, there is no way that the appservice can be informed of this connection problems, so we can't re-connect ourselves. So we'll have to fix this upstream.

To add to this issue, I even get a panic after a while:

[Feb 13, 2019 11:44:07] [User/@remi:.../ERROR] WhatsApp error: unexpected websocket close: websocket: close 1000 (normal)
[Feb 13, 2019 11:44:08] [User/@remi:.../ERROR] WhatsApp error: unexpected websocket close: websocket: close 1000 (normal)
panic: repeated read on failed websocket connection

goroutine 105 [running]:
github.com/gorilla/websocket.(*Conn).NextReader(0xc00027c000, 0xf44680, 0xc000411312, 0x2, 0xc00041c600, 0xc000258180)
	/go/pkg/mod/github.com/gorilla/websocket@v1.4.0/conn.go:967 +0x356
github.com/gorilla/websocket.(*Conn).ReadMessage(0xc00027c000, 0x9ff740, 0xc0002201e0, 0x1, 0x1, 0xb3e060, 0xc0002201e0)
	/go/pkg/mod/github.com/gorilla/websocket@v1.4.0/conn.go:1028 +0x2f
github.com/Rhymen/go-whatsapp.(*Conn).readPump(0xc000219ad0)
	/go/pkg/mod/github.com/!rhymen/go-whatsapp@v0.0.0-20181218094654-2ca6af00572c/conn.go:272 +0x73
created by github.com/Rhymen/go-whatsapp.NewConn
	/go/pkg/mod/github.com/!rhymen/go-whatsapp@v0.0.0-20181218094654-2ca6af00572c/conn.go:129 +0x1ff

@tulir
Copy link
Member

tulir commented Feb 13, 2019

Rhymen/go-whatsapp#34 is somewhat related: there's no way to disconnect cleanly.

@tulir
Copy link
Member

tulir commented Mar 14, 2019

This might be fixable now that Rhymen/go-whatsapp#114 added Disconnect()

@ara4n
Copy link

ara4n commented Mar 15, 2019

another similar failure mode:

error writing to socket: write tcp 192.168.0.128:42210->169.44.82.118:443: write: broken pipe
panic: repeated read on failed websocket connection

goroutine 42 [running]:
github.com/gorilla/websocket.(*Conn).NextReader(0xc00030e160, 0x116dee0, 0xc000441312, 0x2, 0xc000442040, 0xc00023cf00)
        /home/matrix/go/pkg/mod/github.com/gorilla/websocket@v1.4.0/conn.go:967 +0x356
github.com/gorilla/websocket.(*Conn).ReadMessage(0xc00030e160, 0xc002c520f0, 0xc000224f60, 0x1, 0x1, 0xb56700, 0xc002c520f0)
        /home/matrix/go/pkg/mod/github.com/gorilla/websocket@v1.4.0/conn.go:1028 +0x2f
github.com/Rhymen/go-whatsapp.(*Conn).readPump(0xc000306000)
        /home/matrix/go/pkg/mod/github.com/!rhymen/go-whatsapp@v0.0.0-20190208090600-c1173899de99/conn.go:272 +0x73
created by github.com/Rhymen/go-whatsapp.NewConn
        /home/matrix/go/pkg/mod/github.com/!rhymen/go-whatsapp@v0.0.0-20190208090600-c1173899de99/conn.go:129 +0x1ff

@tulir
Copy link
Member

tulir commented Mar 15, 2019

@ara4n That looks like about the same issue as @rreuvekamp had. That doesn't look like the latest version, so try updating since go-whatsapp had some major internal changes.

@tulir
Copy link
Member

tulir commented May 15, 2019

Should be fixed by 689c30407140f0943bb2a19644d7ce58d063c105

@tulir tulir closed this as completed May 15, 2019
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

5 participants