Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

Attach backend connection ID in the log

Ouverte
#310 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

  • #349 par @xhebox — fermée sans fusion

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
35/100
Type d'issue
Fonctionnalité
Clarté
Plutôt claire
Activité
À l'abandon
Stack technique
go
Domaine
backend

Piste de recherche

Commencez par la journalisation des connexions backend dans client/client_conn.go, y compris l’emplacement du journal indiqué à la ligne 72, et suivez le chemin du handshake qui pourrait obtenir ou associer l’ID de connexion TiDB. Le travail est terminé lorsque les journaux des connexions backend contiennent un ID pouvant être associé de manière fiable au journal TiDB correspondant ; l’issue identifie également la journalisation de l’adresse locale comme une alternative à évaluer.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

enhancement

Development Task

Sometimes it's hard to troubleshoot without the backend connection ID.

E.g. when TiProxy prints

[2023/06/12 22:43:19.576 +00:00] [INFO] [main.proxy.conn] [client/client_conn.go:72] [fails to relay the connection] [connID=77] [client_addr=172.30.5.201:44527] [proxy-protocol=false] [backend_addr=db-tidb-1.db-tidb-peer.tidb1379661944646167024.svc:4000] ["quit source"="backend quit"] [error="this is an error from client: failed to read the connection: read tcp 172.30.5.9:6000->172.30.5.201:44527: i/o timeout"] [errorVerbose="this is an error from client: failed to read the connection: read tcp 172.30.5.9:6000->172.30.5.201:44527: i/o timeout\ngithub.com/pingcap/TiProxy/pkg/proxy/net.(*PacketIO).wrapErr\n\t/proxy/pkg/proxy/net/packetio.go:115\ngithub.com/pingcap/TiProxy/pkg/proxy/net.(*PacketIO).ReadPacket\n\t/proxy/pkg/proxy/net/packetio.go:199\ngithub.com/pingcap/TiProxy/pkg/proxy/client.(*ClientConnection).processMsg\n\t/proxy/pkg/proxy/client/client_conn.go:79\ngithub.com/pingcap/TiProxy/pkg/proxy/client.(*ClientConnection).Run\n\t/proxy/pkg/proxy/client/client_conn.go:62\ngithub.com/pingcap/TiProxy/pkg/proxy.(*SQLServer).onConn\n\t/proxy/pkg/proxy/proxy.go:190\ngithub.com/pingcap/TiProxy/pkg/proxy.(*SQLServer).Run.func2.1\n\t/proxy/pkg/proxy/proxy.go:132\ngithub.com/pingcap/TiProxy/lib/util/waitgroup.(*WaitGroup).Run.func1\n\t/proxy/lib/util/waitgroup/waitgroup.go:33\nruntime.goexit\n\t/usr/lib/go/src/runtime/asm_arm64.s:1172"]

It's hard to find why TiDB closes the connection, until I find this log in TiDB:

[2023/06/12 22:42:23.064 +00:00] [INFO] [conn.go:1124] ["read packet timeout, close this connection"] [conn=8770920803001697179] [idle=8h0m0.000026656s] [waitTimeout=28800] [error="read tcp 172.30.4.121:4000->172.30.5.9:60016: i/o timeout"]

If we have the backend connection ID in the log, we can quickly find the TiDB log through the backend connection ID.

Since TiDB connection is 8 bytes but it returns 4 bytes to TiProxy in the handshake, it's not easy to figure out the real backend connection ID. I think it's fine to query TiDB with select connection_id() once the handshake succeeds.

An alternative is to log the local address(especially the port) to the backend connection, because TiDB also prints the TiProxy address.

Langage dominant
Go
Étoiles
73
Forks
40
Merge moyen
4 h 14 min
PR mergées (30 j)
9

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de pingcap/tiproxy

Toutes les issues de pingcap/tiproxy

Issues similaires

Plus d'issues Go

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.