-
Notifications
You must be signed in to change notification settings - Fork 99
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
Hanging at SSL connection #270
Comments
First ...
Have you tried specifying a shorter time range, or tried to disable expand? It could be that the server is struggling to give an answer, perhaps there are too many recurring events? The traceback doesn't say me much - if there is communication going on, it could be that the server is simply slow giving answers. Though, 30 minutes is a lot. |
Cheers. I just tried from 2021/12/1 to 22/01/01 and expand=false and the same thing is happening. Did I specify the port number in the proper way in the url variable? |
I believe that it should work when specified like that, and it seems like I have test code covering it ...
When it just hangs, it could be a firewall issue ... but then it's a bit strange to see reads and writes through strace. Have you tried to access the URL using curl or wget? Can you check with tcpdump that there is actually network traffic going both ways? Do you see any activity in server logs? Python debugger is probably more suitable than strace. According to the traceback, line 583 in /home/mrfry/dev_python/caldav/calendar_fetch/lib/python3.10/site-packages/caldav/davclient.py is the last point from the caldav library. You may try to throw in |
Hey Tobi, I did turn off my firewall and my VPN in case they were the reason but without luck. I ran tcpdump and used the debugger and I have pinpointed the hang to Here is the entire tcpdump. I made sure I had not other programs using the network while I did it.
So I'm trying to investigate this and figure out how to print the error if one occured. Thanks again for your help and guidance with this. It's a good learning experience for me. Edit: Formatting |
No idea how things are "supposed to be done", but I would have done the same :-)
Traffic is flowing both ways, so probably not a firewall issue. What happens if you visit https://posteo.de:8443/ in your browser? (If I do it, I get a login prompt - so whatever is there, it communicates https ... and it apparently runs some variant of sabredav, could be that it's nextcloud ...) |
I tried to register an account, but they want 12 EUR for that. Not a lot of money, but I'm not going to pay that just to test their caldav compliance :-) |
If I go to https://posteo.de:8443/ and fill the login prompt I actually get
Yeah 12 euros will get you a year membership. It's basically a paying email service with green credentials. It's part of my degoogelisation masterplan :) |
So when you mentioned Nextcloud I though, I do have my own Nextcloud instance, I should see if the same issue arises, then I can troubleshoot from the server side! |
Now I get 401 as I'm supposed to.
Seems to be a recursion problem. Could you try with some earlier versions of caldav, like v0.9.2? |
This logic was last changed in afdea80 |
It doesn't make sense to me ... current code looks like this ...
... and your traceback hits the requests line on the bottom there repeatedly (it's probably a red herring that the problem stems from the SSL library ... it's probably rate-limits on the posteo-side that finally causes this to stop up). However, since self.username and self.password is set to None there, that elif branch is not supposed to strike again. The code is some explicit exception for sabre (nextcloud) when username and/or password contains UTF8-characters. Could you try to change your password to something containing only ascii? |
I think it's important to figure out of this ... and I have promised to make a new caldav release during the upcoming week. There seems to be possible to create an account at posteo, choose a non-instant payment scheme, and then they do allow me to start using the account. It just feels wrong and dishonest ... but perhaps I should do that :-) |
I have registered an account with posteo now. Tests run fine (with some exceptions), I don't have any problems with connecting to the server ... but I choose a very plain password, will try to change it (though, the password policy forbids "umlauts" ... hm) |
Hey Tobi, I just gave it another shot as well and it works on my side as well. I have no idea what happened, sorry for the trouble! |
It seems like this problem may be triggered by entering the wrong username and password. Will follow up in #295. |
Hello! Thank you for your time developing this library which I actually have been using unknowingly for a while via this project: https://github.com/greenorca/nextcloud_calcli. I decided to take it back one step and make my own script, and search engines led me here. Anyway, to the issue...
Failure mode: Blinking cursor forever (at least 30mn) when I run
python calendar_fetch.py
.`calendar_fetch.py
import sys
from datetime import date
from datetime import datetime
sys.path.insert(0, "..")
sys.path.insert(0, ".")
import caldav
caldav_url = "https://posteo.de:8443"
username = "[email protected]"
password = "x"
with caldav.DAVClient(url=caldav_url, username=username, password=password) as client:
my_principal = client.principal()
`
I know I probably can't print the events like this but I was going to figure that part out once I got an output (I'm a sunday afternoon script kiddie).
This shows up if I press Ctrl+C
Traceback (most recent call last): File "/home/mrfry/dev_python/caldav/calendar_fetch.py", line 16, in <module> my_principal = client.principal() File "/home/mrfry/dev_python/caldav/calendar_fetch/lib/python3.10/site-packages/caldav/davclient.py", line 412, in principal self._principal = Principal(client=self, *largs, **kwargs) File "/home/mrfry/dev_python/caldav/calendar_fetch/lib/python3.10/site-packages/caldav/objects.py", line 478, in __init__ cup = self.get_property(dav.CurrentUserPrincipal()) File "/home/mrfry/dev_python/caldav/calendar_fetch/lib/python3.10/site-packages/caldav/objects.py", line 210, in get_property foo = self.get_properties([prop], **passthrough) File "/home/mrfry/dev_python/caldav/calendar_fetch/lib/python3.10/site-packages/caldav/objects.py", line 235, in get_properties response = self._query_properties(props, depth) File "/home/mrfry/dev_python/caldav/calendar_fetch/lib/python3.10/site-packages/caldav/objects.py", line 171, in _query_properties return self._query(root, depth) File "/home/mrfry/dev_python/caldav/calendar_fetch/lib/python3.10/site-packages/caldav/objects.py", line 196, in _query ret = getattr(self.client, query_method)(url, body, depth) File "/home/mrfry/dev_python/caldav/calendar_fetch/lib/python3.10/site-packages/caldav/davclient.py", line 460, in propfind return self.request(url or self.url, "PROPFIND", props, {"Depth": str(depth)}) File "/home/mrfry/dev_python/caldav/calendar_fetch/lib/python3.10/site-packages/caldav/davclient.py", line 630, in request return self.request(url, method, body, headers) File "/home/mrfry/dev_python/caldav/calendar_fetch/lib/python3.10/site-packages/caldav/davclient.py", line 655, in request return self.request(url, method, body, headers) File "/home/mrfry/dev_python/caldav/calendar_fetch/lib/python3.10/site-packages/caldav/davclient.py", line 655, in request return self.request(url, method, body, headers) File "/home/mrfry/dev_python/caldav/calendar_fetch/lib/python3.10/site-packages/caldav/davclient.py", line 655, in request return self.request(url, method, body, headers) [Previous line repeated 28 more times] File "/home/mrfry/dev_python/caldav/calendar_fetch/lib/python3.10/site-packages/caldav/davclient.py", line 583, in request r = self.session.request( File "/home/mrfry/dev_python/caldav/calendar_fetch/lib/python3.10/site-packages/requests/sessions.py", line 587, in request resp = self.send(prep, **send_kwargs) File "/home/mrfry/dev_python/caldav/calendar_fetch/lib/python3.10/site-packages/requests/sessions.py", line 701, in send r = adapter.send(request, **kwargs) File "/home/mrfry/dev_python/caldav/calendar_fetch/lib/python3.10/site-packages/requests/adapters.py", line 489, in send resp = conn.urlopen( File "/home/mrfry/dev_python/caldav/calendar_fetch/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen httplib_response = self._make_request( File "/home/mrfry/dev_python/caldav/calendar_fetch/lib/python3.10/site-packages/urllib3/connectionpool.py", line 449, in _make_request six.raise_from(e, None) File "<string>", line 3, in raise_from File "/home/mrfry/dev_python/caldav/calendar_fetch/lib/python3.10/site-packages/urllib3/connectionpool.py", line 444, in _make_request httplib_response = conn.getresponse() File "/usr/lib/python3.10/http/client.py", line 1374, in getresponse response.begin() File "/usr/lib/python3.10/http/client.py", line 318, in begin version, status, reason = self._read_status() File "/usr/lib/python3.10/http/client.py", line 279, in _read_status line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1") File "/usr/lib/python3.10/socket.py", line 705, in readinto return self._sock.recv_into(b) File "/usr/lib/python3.10/ssl.py", line 1274, in recv_into return self.read(nbytes, buffer) File "/usr/lib/python3.10/ssl.py", line 1130, in read return self._sslobj.read(len, buffer) KeyboardInterrupt
I also ran the whole thing with strace and I see reads and writes (the output updates about once a second) with some sort of hierarchy of numbers like "/37/2/406/..." and call to a library file that has to do with ssl certificates I imagine: certifi/cacert.pem. Not posted here in case it's sensitive information.
I'm not sure what to do!
The text was updated successfully, but these errors were encountered: