Skip to content
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

IntegrityError: NOT NULL constraint failed: Statement.predicate #7199

Closed
xoriole opened this issue Nov 22, 2022 · 1 comment
Closed

IntegrityError: NOT NULL constraint failed: Statement.predicate #7199

xoriole opened this issue Nov 22, 2022 · 1 comment
Milestone

Comments

@xoriole
Copy link
Contributor

xoriole commented Nov 22, 2022

The following stack trace is shown when running the latest main (c5a5c33cad9fb776d73166f4237bf844882a22bd)

[PID:959918] 2022-11-22 14:49:13,217 - WARNING - MetadataStore(453) - DB transaction error when tried to process compressed mdblob: Object Statement[new:29] cannot be stored in the database. IntegrityError: NOT NULL constraint failed: Statement.predicate
[PID:959918] 2022-11-22 14:49:13,217 - INFO - PopularityCommunity(309) - Response result: None
[PID:959918] 2022-11-22 14:49:13,217 - ERROR <notifier:252> Notifier._notify(): Object Statement[new:29] cannot be stored in the database. IntegrityError: NOT NULL constraint failed: Statement.predicate
Traceback (most recent call last):
  File "/home/user/tribler/src/tribler/core/utilities/notifier.py", line 250, in _notify
    observer(*args, **kwargs)
  File "/home/user/tribler/src/tribler/core/components/knowledge/rules/tag_rules_processor.py", line 94, in process_torrent_title
    self.save_statements(subject_type=ResourceType.TORRENT, subject=infohash_str, predicate=ResourceType.TAG,
  File "<string>", line 2, in save_statements
  File "/home/user/tribler/venv10/lib/python3.10/site-packages/pony/orm/core.py", line 506, in new_func
    return func(*args, **kwargs)
  File "/home/user/tribler/src/tribler/core/components/knowledge/rules/tag_rules_processor.py", line 107, in save_statements
    self.db.add_auto_generated(subject_type=subject_type, subject=subject, predicate=predicate, obj=obj)
  File "/home/user/tribler/src/tribler/core/components/knowledge/db/knowledge_db.py", line 206, in add_auto_generated
    return self.add_operation(operation, signature=b'', is_local_peer=False, is_auto_generated=True,
  File "/home/user/tribler/src/tribler/core/components/knowledge/db/knowledge_db.py", line 160, in add_operation
    op = self.instance.StatementOp.get_for_update(statement=statement, peer=peer)
  File "/home/user/tribler/venv10/lib/python3.10/site-packages/pony/orm/core.py", line 4017, in get_for_update
    try: return entity._find_one_(kwargs, True, nowait, skip_locked)  # can throw MultipleObjectsFoundError
  File "/home/user/tribler/venv10/lib/python3.10/site-packages/pony/orm/core.py", line 4114, in _find_one_
    if obj is None: obj = entity._find_in_db_(avdict, unique, for_update, nowait, skip_locked)
  File "/home/user/tribler/venv10/lib/python3.10/site-packages/pony/orm/core.py", line 4173, in _find_in_db_
    cursor = database._exec_sql(sql, arguments)
  File "/home/user/tribler/venv10/lib/python3.10/site-packages/pony/orm/core.py", line 938, in _exec_sql
    connection = cache.prepare_connection_for_query_execution()
  File "/home/user/tribler/venv10/lib/python3.10/site-packages/pony/orm/core.py", line 1805, in prepare_connection_for_query_execution
    if not cache.noflush_counter and cache.modified: cache.flush()
  File "/home/user/tribler/venv10/lib/python3.10/site-packages/pony/orm/core.py", line 1891, in flush
    if obj is not None: obj._save_()
  File "/home/user/tribler/venv10/lib/python3.10/site-packages/pony/orm/core.py", line 5424, in _save_
    if status == 'created': obj._save_created_()
  File "/home/user/tribler/venv10/lib/python3.10/site-packages/pony/orm/core.py", line 5276, in _save_created_
    throw(TransactionIntegrityError,
  File "/home/user/tribler/venv10/lib/python3.10/site-packages/pony/utils/utils.py", line 99, in throw
    raise exc
pony.orm.core.TransactionIntegrityError: Object Statement[new:29] cannot be stored in the database. IntegrityError: NOT NULL constraint failed: Statement.predicate
[PID:959918] 2022-11-22 14:49:13,218 - ERROR <taskmanager:135> PopularityCommunity.done_cb(): Task resulted in error: 'NoneType' object is not iterable
Traceback (most recent call last):
  File "/home/user/tribler/src/pyipv8/ipv8/taskmanager.py", line 131, in done_cb
    future.result()
  File "/home/user/tribler/src/tribler/core/components/metadata_store/remote_query_community/remote_query_community.py", line 316, in on_remote_select_response
    newer_entities = [r.md_obj for r in processing_results if r.obj_state == ObjState.LOCAL_VERSION_NEWER]
TypeError: 'NoneType' object is not iterable
@xoriole xoriole added this to the 7.13.0 milestone Nov 22, 2022
@xoriole
Copy link
Contributor Author

xoriole commented Nov 23, 2022

Checking this again migrating from v7.12.1 state directory to the latest main, I'm not able to reproduce the issue. Seems like my personal db is not upgraded well causing the issue so closing this issue. The issue can be reopened if found else where.

@xoriole xoriole closed this as completed Nov 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant