Kozea / Radicale

A simple CalDAV (calendar) and CardDAV (contact) server.
https://radicale.org
GNU General Public License v3.0
3.34k stars 433 forks source link

TypeError: 'str' does not support the buffer interface #667

Closed gx42 closed 1 month ago

gx42 commented 7 years ago

Since exporting Radicale data from 1.1.4 I haven't managed to get the address book syncing yet on 2.1.1 through either the Inverse SOGo connector for Mozilla Thunderbird or DAVdroid for Android. SOGo just says "No changes.", DAVdroid fails with "Address book synchronization failed" and debug export reports "http/1.0 500 Internal Server Error".

Relevant debug log:

[7fe53a708700] ERROR: An exception occurred during PROPFIND request on '/a/addressbook.vcf/': 'str' does not support the buffer interface
Traceback (most recent call last):
  File "/home/gx42/bin/Radicale-2.1.1/radicale/__init__.py", line 298, in __call__
    status, headers, answers = self._handle_request(environ)
  File "/home/gx42/bin/Radicale-2.1.1/radicale/__init__.py", line 464, in _handle_request
    environ, base_prefix, path, user)
  File "/home/gx42/bin/Radicale-2.1.1/radicale/__init__.py", line 742, in do_PROPFIND
    base_prefix, path, xml_content, read_items, write_items, user)
  File "/home/gx42/bin/Radicale-2.1.1/radicale/xmlutils.py", line 746, in propfind
    base_prefix, path, collection, props, user, write=True)
  File "/home/gx42/bin/Radicale-2.1.1/radicale/xmlutils.py", line 927, in _propfind_response
    element.text = item.etag
  File "/home/gx42/bin/Radicale-2.1.1/radicale/storage.py", line 1328, in etag
    for item in self.get_all():
  File "/home/gx42/bin/Radicale-2.1.1/radicale/storage.py", line 1184, in <genexpr>
    return (self.get(href, verify_href=False) for href in self.list())
  File "/home/gx42/bin/Radicale-2.1.1/radicale/storage.py", line 1063, in get
    item, metadata = self._get_with_metadata(href, verify_href=verify_href)
  File "/home/gx42/bin/Radicale-2.1.1/radicale/storage.py", line 1117, in _get_with_metadata
    ctext = vobject_item.serialize()
  File "/usr/local/lib/python3.4/dist-packages/vobject/base.py", line 254, in serialize
    return behavior.serialize(self, buf, lineLength, validate)
  File "/usr/local/lib/python3.4/dist-packages/vobject/behavior.py", line 166, in serialize
    out = base.defaultSerialize(transformed, buf, lineLength)
  File "/usr/local/lib/python3.4/dist-packages/vobject/base.py", line 1007, in defaultSerialize
    child.serialize(outbuf, lineLength, validate=False)
  File "/usr/local/lib/python3.4/dist-packages/vobject/base.py", line 254, in serialize
    return behavior.serialize(self, buf, lineLength, validate)
  File "/usr/local/lib/python3.4/dist-packages/vobject/vcard.py", line 237, in serialize
    VCardTextBehavior.serialize(obj, buf, lineLength, validate)
  File "/usr/local/lib/python3.4/dist-packages/vobject/behavior.py", line 166, in serialize
    out = base.defaultSerialize(transformed, buf, lineLength)
  File "/usr/local/lib/python3.4/dist-packages/vobject/base.py", line 1015, in defaultSerialize
    obj.behavior.encode(obj)
  File "/usr/local/lib/python3.4/dist-packages/vobject/vcard.py", line 161, in encode
    line.value = backslashEscape(line.value)
  File "/usr/local/lib/python3.4/dist-packages/vobject/base.py", line 1216, in backslashEscape
    s = s.replace("\\", "\\\\").replace(";", "\;").replace(",", "\,")
TypeError: 'str' does not support the buffer interface

Radicale 2.1.1 running on Ubuntu 14.04. Calendar appears to work ok.

Unrud commented 7 years ago

VObject doesn't like an item from your address book. Unfortunately the error message is not helpful. I improved the logging for this case. Please install Radicale 2.1.2 and try again.

It should tell you which file is causing the problem. It would be helpful if you could post the problematic address book entry here. You can remove any personal information.

gx42 commented 7 years ago

My apologies, I haven't had time to test it again with a newer revision of Radicale; doing so means removing the calendar from my phone and PC which I rely on daily, which I guess is a testament to how much I rely on it. If I get time I'll try to test again this weekend and will update this issue with the results.

gx42 commented 6 years ago

I've just tested it with 2.1.8 and now it appears to lock up completely after Mozilla Thunderbird reads calendars. It locks up a terminal and pegs a core at 100%, ^C doesn't kill the Python instance, I have to either kill the process from another terminal or terminate the xterm. I've attached the debug output:

R-2.1.8-CrashReport-r.txt

Unrud commented 6 years ago

Radicale has to initialize its internal caches. When your imported collections are big, this can take quiet a while. (Clients may time out.) After the cache for a collections is initialized, subsequent requests will be >100x faster.

pbiering commented 1 month ago

please try with up-to-date radicale and vobject and reopen depending on root cause