Skip to content

Subject instance collision after database connection recovery #85

@iannesbitt

Description

@iannesbitt

Just saw a weird error when running a cleanup scrape of the HD repo:

2025-10-29 19:44:10 [JsonldSpider] INFO: Processing JSON-LD 1 of 1 (https://dvn-cloud.s3.us-east-1.amazonaws.com/10.7910/DVN/ZHF9WC/export_schema.org.cached?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIEJ3NV7UYCSRJC7A%2F20251029%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20251029T194407Z&X-Amz-Expires=7200&X-Amz-SignedHeaders=host&X-Amz-Signature=2bd0a4651973356964363d36dc0fc4e0c83c1377f2c60ab431d6f373a1a04dfd)
2025-10-29 19:44:12 [OPersist] WARNING: OBSOLETED = sha256:8a04038ede53c159b00d7c5b3d4ef0eabb93a22f66fea71f262a0a2d149d8494 in series https://doi.org/10.7910/DVN/ZHF9WC
2025-10-29 19:44:17 [OPersist] ERROR: (sqlite3.OperationalError) database is locked
(Background on this error at: https://sqlalche.me/e/14/e3q8)
2025-10-29 19:44:17 [OPersist] ERROR: Caught sqlalchemy.exc.OperationalError; attempting session restart...
2025-10-29 19:44:17 [OPersist] INFO: Entering session recovery loop
2025-10-29 19:44:17 [OPersist] INFO: Closing old database connection session
2025-10-29 19:44:17 [OPersist] INFO: Opening new database connection session
2025-10-29 19:44:17 [OPersist] INFO: Retrying persist with new session...
2025-10-29 19:44:17 [OPersist] WARNING: OBSOLETED = sha256:8a04038ede53c159b00d7c5b3d4ef0eabb93a22f66fea71f262a0a2d149d8494 in series https://doi.org/10.7910/DVN/ZHF9WC
2025-10-29 19:44:17 [OPersist] ERROR: Failed to store entry in database.
2025-10-29 19:44:17 [OPersist] ERROR: Can't attach instance <Subject at 0x7f44ab9391f0>; another instance with key (<class 'opersist.models.subject.Subject'>, ('http://orcid.org/0000-0002-9528-9470',), None) is already present in this session.
2025-10-29 19:44:17 [OPersist] ERROR: Could not store item under new session: sha256:e52a802af0198b23c21fd6e981216c16fd7fc0c2f58cd834938b9433e883cfd6

The error then recurs for each subsequent item:

2025-10-29 19:44:23 [JsonldSpider] INFO: Processing JSON-LD 1 of 1 (https://dvn-cloud.s3.us-east-1.amazonaws.com/10.7910/DVN/AQVFSD/export_schema.org.cached?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIEJ3NV7UYCSRJC7A%2F20251029%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20251029T194421Z&X-Amz-Expires=7200&X-Amz-SignedHeaders=host&X-Amz-Signature=53f17dba7957da24e4126dc7b5dae06499b4006c786e861966d0e5e2b1bd8627)
2025-10-29 19:44:23 [OPersist] ERROR: Failed to store entry in database.
2025-10-29 19:44:23 [OPersist] ERROR: Can't attach instance <Subject at 0x7f44ab9391f0>; another instance with key (<class 'opersist.models.subject.Subject'>, ('http://orcid.org/0000-0002-9528-9470',), None) is already present in this session.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions