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

Error not handled when uploading a big form #707

Closed
alxndrsn opened this issue Nov 29, 2022 · 4 comments · Fixed by #771
Closed

Error not handled when uploading a big form #707

alxndrsn opened this issue Nov 29, 2022 · 4 comments · Fixed by #771
Assignees
Labels
behavior verified Behavior has been manually verified

Comments

@alxndrsn
Copy link
Contributor

alxndrsn commented Nov 29, 2022

25000q-form.xml.txt

When the big form above is uploaded (with .txt extension removed), I see the following error:

RangeError: Maximum call stack size exceeded
    at sql (/odk/backend/node_modules/slonik/dist/src/factories/createSqlTag.js:36:29)
    at insertMany (/odk/backend/lib/util/db.js:157:13)
    at /odk/backend/lib/model/query/forms.js:72:15
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.transaction (/odk/backend/node_modules/slonik/dist/src/connectionMethods/transaction.js:22:24)
    at async Object.createConnection (/odk/backend/node_modules/slonik/dist/src/factories/createConnection.js:97:18)RangeError: Maximum call stack size exceeded
    at sql (/odk/backend/node_modules/slonik/dist/src/factories/createSqlTag.js:36:29)
    at insertMany (/odk/backend/lib/util/db.js:157:13)
    at /odk/backend/lib/model/query/forms.js:72:15
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.transaction (/odk/backend/node_modules/slonik/dist/src/connectionMethods/transaction.js:22:24)
    at async Object.createConnection (/odk/backend/node_modules/slonik/dist/src/factories/createConnection.js:97:18)::ffff:127.0.0.1 - - [29/Nov/2022:10:13:26 +0000] "POST /v1/projects/973/forms HTTP/1.1" 500 739
Error: Connection terminated
    at Connection.<anonymous> (/odk/backend/node_modules/pg/lib/client.js:132:36)
    at Object.onceWrapper (node:events:627:28)
    at Connection.emit (node:events:525:35)
    at Connection.emit (node:domain:489:12)
    at Socket.<anonymous> (/odk/backend/node_modules/pg/lib/connection.js:57:12)
    at Socket.emit (node:events:513:28)
    at Socket.emit (node:domain:489:12)
    at TCP.<anonymous> (node:net:757:14)node:internal/process/promises:279
            triggerUncaughtException(err, true /* fromPromise */);

Locally, this crashes my node process. On the server, the process does not crash, but the error is sent to Sentry.

An odk-central-frontend user sees:

Screenshot_2022-11-29_13-27-02

The response body contains the full stacktrace (as per #549).

@matthew-white
Copy link
Member

25,000 fields is a lot! I think that's larger than the big forms mentioned in this forum topic.

Based on the stack trace, this seems to be a general issue with insertMany() that could theoretically appear in other areas of the app as well. How about we have insertMany() throw a Problem if passed too many objects? Then at least the result will be a Problem instead of an unhandled error.

@sadiqkhoja sadiqkhoja self-assigned this Feb 14, 2023
@sadiqkhoja
Copy link
Contributor

There is an open issue related to this in Slonik: gajus/slonik#344

@alxndrsn alxndrsn changed the title Error not handlled when uploading a big form Error not handled when uploading a big form Feb 16, 2023
@matthew-white matthew-white added the needs testing Needs manual testing label Feb 21, 2023
@srujner
Copy link

srujner commented Feb 22, 2023

Tested with success!

1 similar comment
@dbemke
Copy link

dbemke commented Feb 22, 2023

Tested with success!

@dbemke dbemke added behavior verified Behavior has been manually verified and removed needs testing Needs manual testing labels Feb 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
behavior verified Behavior has been manually verified
Projects
Status: ✅ done
Development

Successfully merging a pull request may close this issue.

5 participants