peerreview
peerreview copied to clipboard
Paper Sometimes Fails during POST /papers
Describe the bug A clear and concise description of what the bug is.
Large papers will sometimes fail during the POST /papers calls. Log output from one such failure:
Empty PDF!
2023-06-27T17:52:44.575Z:Session(22):error:: Error encountered.
error: insert or update on table "paper_versions" violates foreign key constraint "paper_versions_paper_id_fkey"
at /home/dbingham/src/peerreview/packages/backend/node_modules/pg-pool/index.js:45:11
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async PaperDAO.insertVersion (/home/dbingham/src/peerreview/packages/backend/daos/PaperDAO.js:369:32)
at async PaperDAO.insertVersions (/home/dbingham/src/peerreview/packages/backend/daos/PaperDAO.js:331:13)
at async PaperController.postPapers (/home/dbingham/src/peerreview/web-application/server/controllers/PaperController.js:477:13) {
length: 283,
severity: 'ERROR',
code: '23503',
detail: 'Key (paper_id)=(11) is not present in table "papers".',
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: 'public',
table: 'paper_versions',
column: undefined,
dataType: undefined,
constraint: 'paper_versions_paper_id_fkey',
file: 'ri_triggers.c',
line: '2528',
routine: 'ri_ReportViolation'
}
POST /api/0.0.0/papers 500 10876.663 ms - 24
And postgres error:
2023-06-27 17:52:44.559 UTC [1085] ERROR: insert or update on table "paper_versions" violates foreign key constraint "paper_versions_paper_id_fkey"
2023-06-27 17:52:44.559 UTC [1085] DETAIL: Key (paper_id)=(11) is not present in table "papers".
2023-06-27 17:52:44.559 UTC [1085] STATEMENT:
INSERT INTO paper_versions (paper_id, version, file_id, content, created_date, updated_date)
VALUES ($1, $2, $3, $4, now(), now())
2023-06-27 17:52:44.574 UTC [1086] WARNING: there is no transaction in progress
On resubmission the paper will successfully post at least some of the time.
To Reproduce Steps to reproduce the behavior:
This is a heisenbug, so these steps will not consistently reproduce it.
- Submit a new paper. Upload a very large (50 mb+) file.
- Submit the paper.
Actual behavior What actually happened?
Paper fails to POST, error shown in the logs.
Expected behavior A clear and concise description of what you expected to happen.
Paper posts and user is taken to the drafts review screen.