hydrusnetwork / hydrus

A personal booru-style media tagger that can import files and tags from your hard drive and popular websites. Content can be shared with other users via user-run servers.
http://hydrusnetwork.github.io/hydrus/
Other
2.34k stars 152 forks source link

Server GET /petition 500 #1572

Closed Suika closed 2 months ago

Suika commented 2 months ago

Hydrus version

v581

Qt major version

Qt 6

Operating system

Other (aka none of the above, specify in the comments)

Install method

Third party (AUR, Docker, Chocolatey, etc. Specify in comments)

Install and OS comments

No response

Bug description and reproduction

v581, win32, frozen
ServerException
500: The server's error text was too long to display. The first part follows, while a larger chunk has been written to the log.
Traceback (most recent call last):
  File "hydrus\client\gui\pages\ClientGUIManagementPanels.py", line 5573, in THREADPetitionFetcherAndUploader
  File "hydrus\client\ClientServices.py", line 1278, in Request
  File "hydrus\client\networking\ClientNetworkingJobs.py", line 2039, in WaitUntilDone
hydrus.core.HydrusExceptions.ServerException: 500: The server's error text was too long to display. The first part follows, while a larger chunk has been written to the log.
{"error": "The \"public tag repository\" encountered an error it could not handle!\n\nHere is a full traceback of what happened. If you are using the hydrus client, it will be saved to your log. Please forward it to hydrus.admin@gmail.com:\n\nTraceback (mo

{"error": "The \"public tag repository\" encountered an error it could not handle!\n\nHere is a full traceback of what happened. If you are using the hydrus client, it will be saved to your log. Please forward it to hydrus.admin@gmail.com:\n\nTraceback (mo

Log output

v581, 2024-07-12 17:12:44: 45871 GET /petition 500 in 10.7 milliseconds
v581, 2024-07-12 17:12:45: Traceback (most recent call last):
  File "/usr/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.11/threading.py", line 982, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.11/site-packages/twisted/_threads/_threadworker.py", line 47, in work
    task()
  File "/usr/lib/python3.11/site-packages/twisted/_threads/_team.py", line 182, in doWork
    task()
--- <exception caught here> ---
  File "/usr/lib/python3.11/site-packages/twisted/python/threadpool.py", line 244, in inContext
    result = inContext.theWork()  # type: ignore[attr-defined]
  File "/usr/lib/python3.11/site-packages/twisted/python/threadpool.py", line 260, in <lambda>
    inContext.theWork = lambda: context.call(  # type: ignore[attr-defined]
  File "/usr/lib/python3.11/site-packages/twisted/python/context.py", line 117, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "/usr/lib/python3.11/site-packages/twisted/python/context.py", line 82, in callWithContext
    return func(*args, **kw)
  File "/opt/hydrus/hydrus/server/networking/ServerServerResources.py", line 963, in _threadDoGETJob
    petition = HG.server_controller.Read( 'petition', self._service_key, request.hydrus_account, content_type, status, subject_account_key, reason )
  File "/opt/hydrus/hydrus/core/HydrusController.py", line 730, in Read
    return self._Read( action, *args, **kwargs )
  File "/opt/hydrus/hydrus/core/HydrusController.py", line 203, in _Read
    result = self.db.Read( action, *args, **kwargs )
  File "/opt/hydrus/hydrus/core/HydrusDB.py", line 934, in Read
    return job.GetResult()
  File "/opt/hydrus/hydrus/core/HydrusData.py", line 1289, in GetResult
    raise e
sqlite3.OperationalError: Traceback (most recent call last):

  File "/opt/hydrus/hydrus/core/HydrusDB.py", line 611, in _ProcessJob
    result = self._Read( action, *args, **kwargs )
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/opt/hydrus/hydrus/server/ServerDB.py", line 1763, in _Read
    return self._read_commands_to_methods[ action ]( *args, **kwargs )
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/opt/hydrus/hydrus/server/ServerDB.py", line 3212, in _RepositoryGetPetition
    petition = self._RepositoryGetMappingPetition( service_id, subject_account_id, reason_id )
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/opt/hydrus/hydrus/server/ServerDB.py", line 3017, in _RepositoryGetMappingPetition
    tag_ids_to_hash_ids = HydrusData.BuildKeyToListDict( self._Execute( f'SELECT service_tag_id, service_hash_id FROM {petitioned_mappings_table_name} WHERE account_id = ? AND reason_id = ? LIMIT;', ( petitioner_account_id, reason_id, MAX_MAPPINGS_PER_PETITION ) ) )
                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/opt/hydrus/hydrus/core/HydrusDBBase.py", line 289, in _Execute
    return self._c.execute( query, *query_args )
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

sqlite3.OperationalError: near ";": syntax error
Suika commented 2 months ago

LIMIT with no expression: https://github.com/hydrusnetwork/hydrus/commit/2f5493642be163bcda8567db4a06730cdff0a1f6#diff-fde80644f3ae5ff519425aa3b186bd5d6a3020d342aa7d83c606e55c3a4b0f85

Suika commented 2 months ago

dc0f65d closes #1572