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

Support MySQL servers sending OK packet to QUIT sequence #1277

Closed
kidyfirst opened this issue Nov 12, 2015 · 17 comments
Closed

Support MySQL servers sending OK packet to QUIT sequence #1277

kidyfirst opened this issue Nov 12, 2015 · 17 comments
Assignees
Labels

Comments

@kidyfirst
Copy link

@dougwilson
I found the process that the node-mysql client to discount the connection as follow.
1, client send mysql packet with "request quit" to server.
2, server reply a "fin" packet to client.
3, client replay a "fin" packet to server.

client ip.44859 > server ip.mysql: Flags [P.], cksum 0x6289 (incorrect -> 0x635f), seq 467:472, ack 1152, win 131, options [nop,nop,TS val 1123085762 ecr 4204208361], length 5
14:34:06.790049 IP (tos 0x38, ttl 54, id 56436, offset 0, flags [DF], proto TCP (6), length 52)
    server ip.mysql > client ip.44859: Flags [F.], cksum 0x5f2a (correct), seq 1152, ack 472, win 1716, options [nop,nop,TS val 4204208372 ecr 1123085762], length 0
14:34:06.791501 IP (tos 0x0, ttl 64, id 9867, offset 0, flags [DF], proto TCP (6), length 52)
    client ip.44859 > server ip.mysql: Flags [F.], cksum 0x6550 (correct), seq 472, ack 1153, win 131, options [nop,nop,TS val 1123085772 ecr 4204208372], length 0
14:34:06.828011 IP (tos 0x38, ttl 54, id 56437, offset 0, flags [DF], proto TCP (6), length 52)
    server ip.mysql > client ip.44859: Flags [.], cksum 0x5f16 (correct), seq 1153, ack 473, win 1716, options [nop,nop,TS val 4204208381 ecr 1123085772], length 0

right?

but now, my company's mysql make some customization, server will ignore the "request quit" packet.
it will not notify client to send "fin" packet. the node-mysql can add one option to let client to release the connection?

@dougwilson dougwilson self-assigned this Nov 12, 2015
@dougwilson
Copy link
Member

Hi! I'm not really sure what the ask here is. This module simply implements a client that works with the MySQL protocol, as defined by the MySQL documentation. If you are running against a custom MySQL that has an altered protocol, you're just going to have to fork this module and modify it to function with the modified MySQL protocol.

@kidyfirst
Copy link
Author

@dougwilson thank you reply.
i just confirm that the connection.end() implement the mysql portocol according "server will response a connection close" , whether or not it also support that it will send a "fin" packet when the server response an "ok" packet?

COM_QUIT:
tells the server that the client wants to close the connection

response: either a connection close or a OK_Packet

Payload
1              [01] COM_QUIT
Fields
command (1) -- 0x01 COM_QUIT

Example
01 00 00 00 01

@dougwilson
Copy link
Member

response: either a connection close or a OK_Packet

A connection close is the FIN packets you are seeing, and what we expect, as documented.

@kidyfirst
Copy link
Author

but maybe some server side response a OK_Packet, we should call which API to send "FIN" packets?
can you give any suggestion?

@kidyfirst
Copy link
Author

this._socket.close() ?

@dougwilson
Copy link
Member

Is your server sending an OK packet after the QUIT packet? I can look to see if we handle that currently (it has never been an issue with this driver before), but there's no saying if that will solve your problem unless you confirm first if your server is sending the OK packet.

@kidyfirst
Copy link
Author

yes, our mysql server response OK_packet when receive the quit Protocal

@dougwilson dougwilson reopened this Nov 13, 2015
@dougwilson dougwilson changed the title whether node-mysql can support to allow the client to destory the connection activity. Support MySQL servers sending OK packet to QUIT sequence Nov 13, 2015
@dougwilson
Copy link
Member

Ok, I have updated this issue to be a feature request. PR is welcome to implement the feature.

@kidyfirst
Copy link
Author

thanks

@dougwilson
Copy link
Member

The OK packets are supported now in the current master code. Please install the master and test to confirm if this fixes your issue. You can find the install instructions for testing at https://github.com/felixge/node-mysql#install

@kidyfirst
Copy link
Author

maybe it result in new issue, when the connection count archive the max pool count, it can't create the new connection.

@kidyfirst
Copy link
Author

server throw: 504 Gateway Time-out
and my pool max is 10, when the the netstat archive 10 it will can't release, when the netstat is lower 10, it can release normally.

@dougwilson
Copy link
Member

Hi @kidyfirst , I'm not sure what you are saying, I'm sorry. Can you provide a PR to address this, or even a full program I can use to reproduce the issue?

@kidyfirst
Copy link
Author

sorry, our mysql can't access by outnet on dev and github can't snapshot.

@dougwilson
Copy link
Member

Well, if I don't have a way to reproduce the issue to debug it, there unfortunately isn't much I can do but await a PR from you to fix the issue.

@kidyfirst
Copy link
Author

ok, i can locate the issue by myself, thank your help , can your provide the mail? i can send the snapshot to your.

@kidyfirst
Copy link
Author

i got the mail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants