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

system-wide proxy cannot create a connection ([Errno 9] Bad file descriptor) #3939

Closed
goekce opened this issue Jul 25, 2023 · 6 comments
Closed
Labels
bug Something isn't working

Comments

@goekce
Copy link
Contributor

goekce commented Jul 25, 2023

I want to use the system-wide proxy to create a new Xpra session via the HTML5 client. The client fails after a timeout with connection failed, invalid address?.

Steps to reproduce the behavior:

  1. I use the packaged xpra.service with the following exception: --ssl=off.
  2. Open the http://SERVER_ADDR:port via browser, login
  • Server & client OS: ArchLinux
  • Server version: latest v5.0-r33870 (g27b450d87), client (HTML5 latest f133a43)

I also tried downgrading to 4.4.6. The problem does not exist in 4.4.6. I can bisect if needed.

Remarks:

  • I noticed that it is not possible to start a session via system-wide proxy if pam-selinux is not installed. Is SELinux required for the system-wide proxy? Maybe /etc/pam.d/xpra must be reconfigured, however this is another issue.
  • xpra.service uses --tcp-auth even man xpra states that --tcp-auth is deprecated and bind-tcp=0.0.0.0:14500,auth=... should be used instead. Is the notion of arguments in xpra proxy are slightly different? However I don't think using tcp-auth is related to this issue.
Server logs (auth, proxy, websocket, protocol):

2023-07-25 16:14:22,080 socktype=ws, encryption=, keyfile=''                                                                                                                                                                                                                                                                 
2023-07-25 16:14:22,080 io_thread_loop(read, ) loop starting                                                                                                                                  
2023-07-25 16:14:23,081 untilConcludes(, , , (65536,), {}) timed out, retry=socket.timeout                                                                                                                                                                                                                                                                                               

~10 times above message

2023-07-25 16:14:37,099 untilConcludes(<bound method Connection.is_active of ws socket: ::ffff:10.10.10.10, 14500, 0, 0 <- ::ffff:10.10.20.20, 51030, 0, 0>, <bound method Connection.can_retry of ws socket: <- ::ffff:10.10.20.20, 51030, 0, 0>, <built-in method recv of socket object at 0x7f99fa322980>, (65536,), {}) timed out, retry=socket.timeout
2023-07-25 16:14:37,149 SocketConnection(<socket.socket fd=11, family=10, type=1, proto=0, laddr=('::ffff:10.10.10.10', 14500, 0, 0), raddr=('::ffff:10.10.20.20', 56790, 0, 0)>, ('::ffff:10.10.10.10', 14500
56790, 0, 0), ('::ffff:10.10.20.20', 56790, 0, 0), 'tcp', None, {})
2023-07-25 16:14:37,150 Connection(('::ffff:10.10.20.20', 56790, 0, 0), 'tcp', None, {})
2023-07-25 16:14:37,150 tcp options: cork=True, nodelay=None

~10 times the untilConcludes message again

2023-07-25 16:14:53,096 flush_then_close(<bound method SocketProtocol.encode of WebSocket(ws socket: ::ffff:10.10.10.10, 14500, 0, 0 <- ::ffff:10.10.20.20, 51030, 0, 0)>, ['disconnect', 'login timeout'], <function noop at 0x7f99fc508f40>) closed=False
2023-07-25 16:14:53,096 flush_then_close: wait_for_write_lock()
2023-07-25 16:14:53,096 flush_then_close: acquired the write lock
2023-07-25 16:14:53,096 flush_then_close: queue is now empty, sending the last packet and closing
2023-07-25 16:14:53,096 packet type send alias not found for 'disconnect'
2023-07-25 16:14:53,096 sending 26 bytes without header
2023-07-25 16:14:53,096 make_wsframe_header(disconnect, 1 items) 26 bytes, ws_mask=False, header=0x821a (2 bytes)
2023-07-25 16:14:53,096 raw_write for disconnect, starting write thread
2023-07-25 16:14:53,097 io_thread_loop(write, <bound method SocketProtocol._write of WebSocket(ws socket: ::ffff:10.10.10.10, 14500, 0, 0 <- ::ffff:10.10.20.20, 51030, 0, 0)>) loop starting
2023-07-25 16:14:53,097 changed ws socket to nodelay=True
2023-07-25 16:14:53,097 flush_then_close: packet_queued() closed=False
2023-07-25 16:14:53,097 flush_then_close: wait_for_packet_sent() queue.empty()=True, closed=False
2023-07-25 16:14:53,097 close_and_release()
2023-07-25 16:14:53,098 flush_then_close(None, b'\x88\x02\x03\xe8', <function noop at 0x7f99fc508f40>) had already been called, this new request has been ignored
2023-07-25 16:14:53,098 Protocol.close(None) closed=False, connection=ws socket: ::ffff:10.10.10.10, 14500, 0, 0 <- ::ffff:10.10.20.20, 51030, 0, 0
2023-07-25 16:14:53,098 Protocol.close(None) calling <bound method SocketConnection.close of ws socket: ::ffff:10.10.10.10, 14500, 0, 0 <- ::ffff:10.10.20.20, 51030, 0, 0>
2023-07-25 16:14:53,098 ws socket: ::ffff:10.10.10.10, 14500, 0, 0 <- ::ffff:10.10.20.20, 51030, 0, 0.close() socket=<socket.socket fd=8, family=10, type=1, proto=0, laddr=('::ffff:10.10.10.10', 14500, 0, 0), raddr=('::ffff:10.10.20.20', 51030, 0, 0)>
2023-07-25 16:14:53,098 ws socket: ::ffff:10.10.10.10, 14500, 0, 0 <- ::ffff:10.10.20.20, 51030, 0, 0.close() done
2023-07-25 16:14:53,098 terminate_queue_threads()
2023-07-25 16:14:53,098 Protocol.close(None) done
2023-07-25 16:14:53,098 io_thread_loop(write, <bound method SocketProtocol._write of WebSocket(None)>) loop ended, closed=True
2023-07-25 16:14:53,121 can_retry: <class 'OSError'>, args=(9, 'Bad file descriptor'), errno=9, code=9, abort=9
2023-07-25 16:14:53,121 None closed in read loop
Traceback (most recent call last):
File "/usr/lib/python3.11/site-packages/xpra/net/protocol/socket_handler.py", line 666, in _io_thread_loop
while not self._closed and callback():
^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/xpra/net/protocol/socket_handler.py", line 757, in _read
buf = self.con_read()
^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/xpra/net/protocol/socket_handler.py", line 775, in con_read
return self._conn.read(self.read_buffer_size)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/xpra/net/bytestreams.py", line 348, in read
return self._read(self._socket.recv, n)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/xpra/net/bytestreams.py", line 164, in _read
r = self.untilConcludes(*args)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/xpra/net/bytestreams.py", line 149, in untilConcludes
return untilConcludes(self.is_active, self.can_retry, *args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/xpra/net/bytestreams.py", line 85, in untilConcludes
retry = can_retry_cb(e)
^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/xpra/net/bytestreams.py", line 146, in can_retry
return can_retry(e)
^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/xpra/net/bytestreams.py", line 75, in can_retry
raise ConnectionClosedException(e) from None
xpra.net.common.ConnectionClosedException: [Errno 9] Bad file descriptor
2023-07-25 16:14:58,102 close_and_release()

@goekce goekce added the bug Something isn't working label Jul 25, 2023
@totaam
Copy link
Collaborator

totaam commented Jul 25, 2023

Please try first on a supported OS like Fedora, I do not have ArchLinux to test.

@goekce
Copy link
Contributor Author

goekce commented Jul 25, 2023

Oh, I did not know that ArchLinux is not supported. Does this mean that you are not interested in helping ArchLinux users either?

I don't have have any experience with Fedora ecosystem. If you are interested I can prepare a Docker image or bisect.

@totaam
Copy link
Collaborator

totaam commented Jul 25, 2023

Oh, I did not know that ArchLinux is not supported.

https://github.com/Xpra-org/xpra/wiki/Platforms

Does this mean that you are not interested in helping ArchLinux users either?

No it means that my "free" time is very limited: https://xpra.org/list/2023-July/002987.html
Supporting 30+ distribution variants is non starter.

@goekce
Copy link
Contributor Author

goekce commented Jul 26, 2023

I feel sorry 😐. I will open a PR after I have a rough idea where the problem could be. My OS is not supported so I want to leave space for more important issues.


Regarding project management changes:

I have been also asking myself how you handle this large project alone. I don't have experience with sustaining open source projects. What I saw in another open source project is:

  1. Asking directly in the issue template if the person would like to contribute with a PR. (Even many people cannot contribute, this still nudges people that this is the norm or expected.)
  2. If yes: the project maintainer roughly explains what should be done and where to look at. Then the maintainer supports the PR if needed

@goekce goekce closed this as completed Jul 26, 2023
@totaam
Copy link
Collaborator

totaam commented Jul 27, 2023

Interestingly, the missing attributes had been flagged in: #3930 (comment).

@goekce
Copy link
Contributor Author

goekce commented Aug 8, 2023

The Bad file descriptor error seems to be solved and the rest seems to be related to the Nginx proxy. I opened #3958 for that.

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

2 participants