-
-
Notifications
You must be signed in to change notification settings - Fork 8
Monitor.py: fix Failed to establish a new connection: [Errno 111] Con… #104
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
base: main
Are you sure you want to change the base?
Conversation
|
@ivanucherdzhiev Thanks for the thorough analysis and the fix. However, this custom implementation adds some complexity and long-term maintenance overhead. I suggest we consider using the Podman Python SDK instead of handling this logic manually. Could you explore whether |
|
@NN708 thank you very much for your time. I believe you are absolutely right. I will explore how that might be done with Should I cancel the PR or leave it as a temporary solution until better approach is done? |
|
@ivanucherdzhiev Feel free to keep the PR open for now. Once your new implementation is ready, you can update the branch with a force push. This will keep all the discussion in one place. |
|
@NN708 okay thank you. Thank you again for your time! |
8f7204e to
c65aeb6
Compare
|
@NN708 I made it work with |
c65aeb6 to
cf4d406
Compare
|
Sorry I made second push because I forgot to remove unneeded test stuff from the first one The new implementation uses
|
NN708
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The client.events() appears to support datetime directly for since parameter, so we should be able to just use datetime.now() and remove the __get_datetime() function.
Regarding the code's functionality, I'm not sure if it's working as intended. My tests show that it does eliminate the error, but the status in the GUI still doesn't seem to update.
|
Hmm that interesting on my tests it works perfectly maybe there is mismatch of
@NN708 if you are testing without setting |
cf4d406 to
e45f735
Compare
|
@NN708 i made few small changes
Thank you very much for your time and support! |
Co-authored-by: Ivan <[email protected]>
e45f735 to
48d6153
Compare
That's right,
I have also addressed the scenario where UID is not 1000. |
NN708
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am still unable to retrieve events. The response is always empty:
DEBUG:Vanilla::Async:Running async job [<function Monitor.read at 0x7ff4b6da5440>].
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): %2frun%2fuser%2f1001%2fpodman%2fpodman.sock:80
DEBUG:urllib3.connectionpool:http://%2frun%2fuser%2f1001%2fpodman%2fpodman.sock:80 "GET /v5.6.0/libpod/events?filters=%7B%22event%22%3A+%5B%22start%22%2C+%22died%22%5D%7D&since=1768980553&stream=True&until=1768980555 HTTP/1.1" 200 None
DEBUG:apx_gui.core.monitor:DEBUG: Window was empty. Try starting/stopping a container now.
Testing Podman directly indicates that this appears to be an issue with Podman itself. Running the following command returns nothing, even when an event has occurred:
$ podman events --since "1768980526" --until "1768980555" --filter "event=died" --filter "event=start"Events are only returned when the until parameter is set to a timestamp after current time:
$ podman events --since "1768980526" --until "1769000000" --filter "event=died" --filter "event=start"
2026-01-21 15:28:57.158083386 +0800 CST container died 33de39acc5324033f067696398294793c158dd1008fd8009a564ff624cb84d0a (image=docker.io/library/alpine:latest, name=apx-test, manager=apx, name=test, nvidia=true, stack=alpine, distrobox.unshare_groups=0)Since the root cause lies outside our implementation, I approve the PR. I would also appreciate feedback from other developers.
|
i upgraded the version and everything works perfectly! Thank you again! |
|
@ivanucherdzhiev Thank you for your contribution! ❤️ |



fix Failed to establish a new connection: [Errno 111] Connection refused
after tracing (with strace) whats going on i saw that instead of
UNIXsocked used to connect to to/run/user/1001/podman/podman.sockthe python libraryurllib3ignores theUNIXsocked and usesAF_INETand tries to connect with TCP as it is connecting to HTTP server.after some research i found out that this behavior is because of
HTTPConnectionPoolso i tried to override it with a custom one which forces the use of theUNIXsockedthis combined with this line
self.poolmanager = SocketPoolManager(self.__sock_addr)forces the use of the
UNIXsocket to connect to the/run/user/1001/podman/podman.sock__socket_path = f"{os.environ.get('XDG_RUNTIME_DIR')}/podman/podman.sock"this change is done in order to avoid hard coding the user UUID but instead getting it from the environment variableXDG_RUNTIME_DIRthis commit adress #62