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

telegram server automatically closes my TCP connection #1110

Closed
xiaolan123 opened this issue May 29, 2023 · 4 comments
Closed

telegram server automatically closes my TCP connection #1110

xiaolan123 opened this issue May 29, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@xiaolan123
Copy link

When I add many public groups or channels to my account, if there is a review message, the link will be automatically closed by the tg server every 15 minutes or so

tdlog:
{"level":"debug","ts":"2023-05-29 11:24:52","logger":"conn.mtproto.read","msg":"Read loop done","v":"v0.83.0","conn_id":0,"dc_id":5,"reason":"read: read: read intermediate: read length: EOF","reasonVerbose":"read:\n github.com/gotd/td/internal/mtproto.(*Conn).readLoop\n /root/go/pkg/mod/github.com/gotd/td@v0.83.0/internal/mtproto/read.go:214\n - read:\n github.com/gotd/td/transport.(*connection).Recv\n /root/go/pkg/mod/github.com/gotd/td@v0.83.0/transport/connection.go:70\n - read intermediate:\n github.com/gotd/td/internal/proto/codec.Intermediate.Read\n /root/go/pkg/mod/github.com/gotd/td@v0.83.0/internal/proto/codec/intermediate.go:73\n - read length:\n github.com/gotd/td/internal/proto/codec.readLen\n /root/go/pkg/mod/github.com/gotd/td@v0.83.0/internal/proto/codec/codec.go:35\n - EOF"}

tcpdump
91.108.56.125.443 > 103.122.98.115.57236: Flags [P.], cksum 0x042c (correct), seq 904965:906193, ack 35404, win 14912, options [nop,nop,TS val 149279870 ecr 107897976], length 1228
00:14:56.670365 IP (tos 0x0, ttl 64, id 25105, offset 0, flags [DF], proto TCP (6), length 52)
103.122.98.115.57236 > 91.108.56.125.443: Flags [.], cksum 0x5f56 (incorrect -> 0x5454), ack 906193, win 1424, options [nop,nop,TS val 107898013 ecr 149279870], length 0
00:14:56.671105 IP (tos 0x0, ttl 55, id 2473, offset 0, flags [DF], proto TCP (6), length 1200)
91.108.56.125.443 > 103.122.98.115.57236: Flags [P.], cksum 0xf885 (correct), seq 906193:907341, ack 35404, win 14912, options [nop,nop,TS val 149279871 ecr 107897976], length 1148
00:14:56.671142 IP (tos 0x0, ttl 64, id 25106, offset 0, flags [DF], proto TCP (6), length 52)
103.122.98.115.57236 > 91.108.56.125.443: Flags [.], cksum 0x5f56 (incorrect -> 0x4fd6), ack 907341, win 1424, options [nop,nop,TS val 107898014 ecr 149279871], length 0
00:14:56.706742 IP (tos 0x0, ttl 55, id 2474, offset 0, flags [DF], proto TCP (6), length 52)
91.108.56.125.443 > 103.122.98.115.57236: Flags [F.], cksum 0x1b01 (correct), seq 907341, ack 35404, win 14912, options [nop,nop,TS val 149279907 ecr 107898014], length 0
00:14:56.746132 IP (tos 0x0, ttl 64, id 25107, offset 0, flags [DF], proto TCP (6), length 52)
103.122.98.115.57236 > 91.108.56.125.443: Flags [.], cksum 0x5f56 (incorrect -> 0x4f66), ack 907342, win 1424, options [nop,nop,TS val 107898089 ecr 149279907], length 0
00:15:03.839441 IP (tos 0x0, ttl 64, id 25108, offset 0, flags [DF], proto TCP (6), length 56)

@xiaolan123 xiaolan123 added the bug Something isn't working label May 29, 2023
@xiaolan123
Copy link
Author

  my code 

client.Run(ctx, func(ctx context.Context) error {
	for true {
		SendMessageRequest := &tg.MessagesSendMessageRequest{
			Peer: &tg.InputPeerChannel{
				ChannelID:  chatId,
				AccessHash: chatHash,
			},
			Message:  "hello",
			RandomID: randId,
		}
		client.API().MessagesSendMessage(ctx, SendMessageRequest)
		time.Sleep(30 * time.Second)
	}
	return nil
})

@xiaolan123
Copy link
Author

client.Run(ctx, func(ctx context.Context) error {
for true {
time.Sleep(30 * time.Second)
}
return nil
})

I also found that even if I didn't do anything, I would still make this mistake : read length: EOF

@jhemmmm
Copy link

jhemmmm commented Jun 10, 2023

Probably this?.
#1030

@ernado
Copy link
Member

ernado commented Jan 21, 2024

I'm closing this in favor of #1030.

I'm trying to find a way to reproduce this issue.
Tried something like that:

sudo ss -K dst 149.154.167.50

Just closing connection does not reproduce this issue, so probably another way is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants