aiortc / aioquic

QUIC and HTTP/3 implementation in Python
BSD 3-Clause "New" or "Revised" License
1.69k stars 238 forks source link

Client ConnectionError on FreeBSD #87

Closed janev94 closed 2 years ago

janev94 commented 4 years ago

Hi,

I am successfully able to run http3_server.py, but if I try to run the example client I get:

 Traceback (most recent call last):
  Fi "examples/http3_client.py", line 426, in <module>
  int_response=args.print_response,
  Fi "/usr/local/lib/python3.7/asyncio/base_events.py", line 583, in run_until_complete
  turn future.result()
  Fi "examples/http3_client.py", line 317, in run
  ssion_ticket_handler=save_session_ticket,
  Fi "/usr/local/lib/python3.7/contextlib.py", line 170, in __aenter__
  turn await self.gen.__anext__()
  Fi "/usr/home/vagrant/aiortc/aioquic/src/aioquic/asyncio/client.py", line 89, in connect
  ait protocol.wait_connected()
  Fi "/usr/home/vagrant/aiortc/aioquic/src/aioquic/asyncio/protocol.py", line 127, in wait_connected
await asyncio.shield(self._connected_waiter)
ConnectionError

I have tried creating a custom client and connecting to external servers e.g., https://cloudflare-quic.com/and https://quic.aiortc.org/ with both the example and my custom client and I get the same issue. I have checked that the ALPN protocols match from my client and the server and am running out of ideas :/ Any ideas?

P.S. Before getting the server example running I had to update my openssl but I do not believe that to be the issue as it is now running fine...

jlaine commented 4 years ago

As there is no error message here my guess is that you are hitting a timeout. Could you take a wireshark capture to check packets are being exchanged?

janev94 commented 4 years ago

This is exactly where it gets really odd. I do not see ANY packets being exchanged on the local interface ?! If I try to do it with a remote example to quic.aiortc.org on port 4433 I see the DNS request for quic.aiortc.org but nothing after that. Also am uploading a qlog file as reported by the client and in it you are able to see that it is trying to send initial packets but it is later reporting them as lost every time... No idea what is happening. I have checked that I can send/receive UDP packets on udp/4433 so it is not a weird firewall rule. quic.log

Here's what else is interesting: even though a H3Connection object is created, I never see a call to the init function for the associated class, even though self._httpfrom the example server was None before that. But I see where the call to the constructor is made and I can confirm that an H3 object is being created after that call.

jlaine commented 4 years ago

You're going to have to provide detailed instructions on how to reproduce, because I am confused about how you are running your test.

Here is an example:

$ python examples/http3_client.py https://quic.aiortc.org/5000000
2020-04-22 08:56:13,082 INFO quic [e95cc6f5916b51fe] ALPN negotiated protocol h3-27
2020-04-22 08:56:13,083 INFO client New session ticket received
2020-04-22 08:56:14,162 INFO client Received 5000000 bytes in 1.1 s (37.143 Mbps)
janev94 commented 4 years ago

Right, I am attaching a vagrantfile that sets-up vm and installs in it all dependencies to reproduce the problem.

You'd need virtualbox and vagrant. Then do vagrant up in the folder where the Vagrantfile is. This will take a while as it sets up the box and pulls everything needed (you can inspect what it is doing in the Vagrantfile itself, it's all in the $script variable.

After vagrant up finishes, you may either: a. vagrant ssh to log into the box, then cd aioquic followed by python examples/http3_client.py https://quic.aiortc.org/5000000 or b. vagrant ssh -c "cd aioquic && python examples/http3_client.py https://quic.aiortc.org/5000000". The second one will send these commands to the VM, print the output and end the connection.

Vagrantfile.zip

P.S.. I've zipped the Vagrantfile as GH would not let me upload files without extension.

jlaine commented 4 years ago

Let's keep vagrant and virtual machines out of the equation, I already have little time to support my own projects, I don't plan to go into debugging interactions with third party tools. Can you reproduce the issue directly on your local machine?

janev94 commented 4 years ago

Yes the issue originated on my local machine. I created the vagrant to start with a clean copy and make sure that it was not some dependency issue with packages that I already have. If you want to reproduce it locally, obtain a freeBSD 11.3-RELEASE image, install git, clone the repo, and build the dependencies. I could be OS-related issue since my ubuntu machine does not have the same issue, so reproduction is tricky...

jlaine commented 4 years ago

I'm sorry but I won't have time to set up freeBSD to reproduce the issue. You're welcome to investigate and report back if you find a fix, but I'm assuming it has something to do with how the sockets are opened. Here is where I suggest you look: src/aioquic/asyncio/client.py

janev94 commented 4 years ago

Got it, will add it to my backlog and report if I get to it and find anything.

Cheers

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.