Skip to content
Snippets Groups Projects

api/snapshot: Fix regression triggering error with postgresql storage

Merged Antoine Lambert requested to merge anlambert/swh-web:api-snapshot-fix-regression into master

We missed it as swh-web tests are executed with a memory storage backend.

Fortunately we use the cassandra backend in production so only docker environment with default services is affected.

swh-storage-1  | [19/Feb/2025:14:48:27 +0000] POST /snapshot/missing HTTP/1.0 200 1 1
swh-storage-1  | malformed array literal: ""
swh-storage-1  | LINE 2: ...04c69db38739bef6b6cae'::bytea, '\x'::bytea, 1001, '' :: snap...
swh-storage-1  |                                                              ^
swh-storage-1  | DETAIL:  Array value must start with "{" or dimension information.
swh-storage-1  | Traceback (most recent call last):
swh-storage-1  |   File "/srv/softwareheritage/venv/lib/python3.11/site-packages/flask/app.py", line 917, in full_dispatch_request
swh-storage-1  |     rv = self.dispatch_request()
swh-storage-1  |          ^^^^^^^^^^^^^^^^^^^^^^^
swh-storage-1  |   File "/srv/softwareheritage/venv/lib/python3.11/site-packages/flask/app.py", line 902, in dispatch_request
swh-storage-1  |     return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
swh-storage-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
swh-storage-1  |   File "/srv/softwareheritage/venv/lib/python3.11/site-packages/swh/storage/metrics.py", line 28, in d
swh-storage-1  |     return f(*a, **kw)
swh-storage-1  |            ^^^^^^^^^^^
swh-storage-1  |   File "/srv/softwareheritage/venv/lib/python3.11/site-packages/swh/core/api/negotiation.py", line 153, in newf
swh-storage-1  |     return f.negotiator(*args, **kwargs)
swh-storage-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
swh-storage-1  |   File "/srv/softwareheritage/venv/lib/python3.11/site-packages/swh/core/api/negotiation.py", line 81, in __call__
swh-storage-1  |     result = self.func(*args, **kwargs)
swh-storage-1  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^
swh-storage-1  |   File "/srv/softwareheritage/venv/lib/python3.11/site-packages/swh/core/api/__init__.py", line 622, in f
swh-storage-1  |     ret = obj_meth(**kw)
swh-storage-1  |           ^^^^^^^^^^^^^^
swh-storage-1  |   File "/srv/softwareheritage/venv/lib/python3.11/site-packages/swh/storage/postgresql/storage.py", line 158, in _meth
swh-storage-1  |     return meth(self, *args, **kwargs)
swh-storage-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
swh-storage-1  |   File "/srv/softwareheritage/venv/lib/python3.11/site-packages/swh/core/db/common.py", line 73, in _meth
swh-storage-1  |     return meth(self, *args, db=db, cur=cur, **kwargs)
swh-storage-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
swh-storage-1  |   File "/srv/softwareheritage/venv/lib/python3.11/site-packages/swh/storage/postgresql/storage.py", line 1236, in snapshot_get_branches
swh-storage-1  |     fetched_branches = list(
swh-storage-1  |                        ^^^^^
swh-storage-1  |   File "/srv/softwareheritage/venv/lib/python3.11/site-packages/swh/storage/postgresql/db.py", line 909, in snapshot_get_by_id
swh-storage-1  |     cur.execute(
swh-storage-1  | psycopg2.errors.InvalidTextRepresentation: malformed array literal: ""
swh-storage-1  | LINE 2: ...04c69db38739bef6b6cae'::bytea, '\x'::bytea, 1001, '' :: snap...
swh-storage-1  |                                                              ^
swh-storage-1  | DETAIL:  Array value must start with "{" or dimension information.
swh-storage-1  | 
swh-storage-1  | [19/Feb/2025:14:48:27 +0000] POST /snapshot/get_branches HTTP/1.0 500 2807 21
swh-storage-1  | [19/Feb/2025:14:48:46 +0000] GET / HTTP/1.1 200 324 0
swh-storage-1  | [19/Feb/2025:14:49:01 +0000] POST /snapshot/missing HTTP/1.0 200 1 1
swh-storage-1  | malformed array literal: ""
swh-storage-1  | LINE 2: ...04c69db38739bef6b6cae'::bytea, '\x'::bytea, 1001, '' :: snap...
swh-storage-1  |                                                              ^
swh-storage-1  | DETAIL:  Array value must start with "{" or dimension information.
Edited by Antoine Lambert

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
Please register or sign in to reply
Loading