Skip to content

Unclear error message when running into (some types of?) connection timeouts

When the connection times out before the response is retrieved, an Error claiming a broken XML was returned is raised.

E.g., on a slow server with a lot of entities, try

import caosdb as db
db.execute_query("FIND RECORD")

In the server, this results in a broken connection, i.e.

linkahead        | 2022-12-22	09:30:07	10.3.128.2	-	127.0.0.1	10443	GET	/Entity	query=FIND%20RECORD	200	-	0	31192	https://localhost:8081	caosdb-pylib/0.10.1.dev0+6a91151 - _DefaultCaosDBServerConnection	-
linkahead        | The connection was broken. It was probably closed by the client. Reason: null

but the client shows

In [2]: db.execute_query("FIND RECORD")
Traceback (most recent call last):

  File /usr/lib/python3.10/site-packages/IPython/core/interactiveshell.py:3433 in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)

  Cell In[2], line 1
    db.execute_query("FIND RECORD")

  File ~/.local/lib/python3.10/site-packages/caosdb/common/models.py:4263 in execute_query
    return query.execute(unique=unique,

  File ~/.local/lib/python3.10/site-packages/caosdb/common/models.py:4197 in execute
    http_response = connection.retrieve(

  File ~/.local/lib/python3.10/site-packages/caosdb/connection/connection.py:582 in retrieve
    http_response = self._http_request(method="GET", path=path, **kwargs)

  File ~/.local/lib/python3.10/site-packages/caosdb/connection/connection.py:660 in _http_request
    return self._retry_http_request(method=method, path=path,

  File ~/.local/lib/python3.10/site-packages/caosdb/connection/connection.py:700 in _retry_http_request
    _handle_response_status(http_response)

  File ~/.local/lib/python3.10/site-packages/caosdb/connection/connection.py:501 in _handle_response_status
    raise HTTPServerError(body=body)

  File ~/.local/lib/python3.10/site-packages/caosdb/exceptions.py:86 in __init__
    xml = etree.fromstring(body)

  File src/lxml/etree.pyx:3237 in lxml.etree.fromstring

  File src/lxml/parser.pxi:1896 in lxml.etree._parseMemoryDocument

  File src/lxml/parser.pxi:1784 in lxml.etree._parseDoc

  File src/lxml/parser.pxi:1141 in lxml.etree._BaseParser._parseDoc

  File src/lxml/parser.pxi:615 in lxml.etree._ParserContext._handleParseResultDoc

  File src/lxml/parser.pxi:725 in lxml.etree._handleParseResult

  File src/lxml/parser.pxi:654 in lxml.etree._raiseParseError

  File <string>:1
XMLSyntaxError: Start tag expected, '<' not found, line 1, column 1
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information