DicksonWu654 opened a new pull request, #4267:
URL: https://github.com/apache/ambari/pull/4267
## What changes were proposed in this pull request?
`PingPortListener.run` calls `conn.send("OK")`. On Python 3 `socket.send`
needs bytes, so it raises `TypeError`. The except branch logs "a bytes-like
object is required, not 'str'" and calls `sys.exit(1)`, which ends the listener
thread. So the first connection to the ping port gets an empty reply, the
thread exits, and every later connection hangs until it times out. The agent
process itself keeps running.
This changes the reply to `b"OK"`.
## How was this patch tested?
I ran the real `PingPortListener` class from trunk (445e0bc4) under Python
3.12 on 127.0.0.1, with `ping_port=0` and the fuser check stubbed out, and
opened three connections:
- before: the first gets `b''` and the thread is dead; the next two time out
- after: all three get `b"OK"` and the thread stays alive
I haven't run the full agent test suite. I didn't open a JIRA for this -
happy to if you'd like one for the title.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]