gotd / td

Telegram client, in Go. (MTProto API)
MIT License
1.52k stars 135 forks source link

MessagesSendMessage freezes forever #1363

Open TrixiS opened 7 months ago

TrixiS commented 7 months ago

Description: After some time of running a client MessagesSendMessage request sleeps forever. Seems like a deadlock, but I am not really sure. Some debug logs provided below

What version of gotd are you using?

github.com/gotd/td v0.99.2

Can this issue be reproduced with the latest version?

Yes

What did you do?

API.MessagesSendMessage

What did you expect to see?

A message to be sent

What did you see instead?

MessagesSendMessage method sleeps forever

What Go version and environment are you using?

go version go1.21.1 linux/amd64

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/root/.cache/go-build'
GOENV='/root/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.21.1'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/app/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1773707187=/tmp/go-build -gno-record-gcc-switches'

I run MessagesSendMessage with timeout of 5 minutes, context closes

Debug logs:

{"level":"debug","ts":1713448933.1994636,"logger":"conn.mtproto","caller":"mtproto/new_encrypted_msg.go:62","msg":"Request","v":"v0.99.2","conn_id":0,"dc_id":2,"type_id":"0xf3427b8c","type_name":"ping_delay_disconnect#f3427b8c","msg_id":7359207130800523400}
{"level":"debug","ts":1713448933.1996253,"logger":"conn.mtproto.group","caller":"tdsync/cancel_group.go:48","msg":"Task stopped","v":"v0.99.2","conn_id":0,"dc_id":2,"task":"pingLoop","error":"disconnect (pong missed): write: write: write intermediate: write tcp 188.120.255.161:60372->149.154.167.51:443: write: broken pipe","errorVerbose":"disconnect (pong missed):\n    github.com/gotd/td/mtproto.(*Conn).pingLoop\n        /go/pkg/mod/github.com/gotd/td@v0.99.2/mtproto/ping.go:115\n  - write:\n    github.com/gotd/td/mtproto.(*Conn).pingDelayDisconnect\n        /go/pkg/mod/github.com/gotd/td@v0.99.2/mtproto/ping.go:71\n  - write:\n    github.com/gotd/td/transport.(*connection).Send\n        /go/pkg/mod/github.com/gotd/td@v0.99.2/transport/connection.go:48\n  - write intermediate:\n    github.com/gotd/td/proto/codec.Intermediate.Write\n        /go/pkg/mod/github.com/gotd/td@v0.99.2/proto/codec/intermediate.go:64\n  - write tcp 188.120.255.161:60372->149.154.167.51:443: write: broken pipe","elapsed":60300.000978525}
{"level":"debug","ts":1713448933.1999178,"logger":"conn.mtproto","caller":"mtproto/conn.go:172","msg":"Closing","v":"v0.99.2","conn_id":0,"dc_id":2}
{"level":"info","ts":1713448933.1999276,"logger":"conn.mtproto.rpc","caller":"rpc/engine.go:271","msg":"Close called","v":"v0.99.2","conn_id":0,"dc_id":2}
{"level":"debug","ts":1713448933.1999583,"logger":"conn.mtproto.group","caller":"tdsync/cancel_group.go:48","msg":"Task stopped","v":"v0.99.2","conn_id":0,"dc_id":2,"task":"ackLoop","error":"acl: context canceled","errorVerbose":"acl:\n    github.com/gotd/td/mtproto.(*Conn).ackLoop\n        /go/pkg/mod/github.com/gotd/td@v0.99.2/mtproto/ack.go:33\n  - context canceled","elapsed":60300.00136314}
{"level":"debug","ts":1713448933.2000499,"logger":"conn.mtproto.group","caller":"tdsync/cancel_group.go:48","msg":"Task complete","v":"v0.99.2","conn_id":0,"dc_id":2,"task":"handleClose","elapsed":60300.001440411}
ernado commented 7 months ago

Looks like #1030

TrixiS commented 7 months ago

Looks like #1030

Yeah. All I do is listening to hundreds of channels and sending messages in one to many manner. So it's kinda like this person said

TrixiS commented 7 months ago

Application restart helps tho