-
Notifications
You must be signed in to change notification settings - Fork 861
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
Unable to write large objects #1865
Comments
The current large objects We can either document the limitation or internally make multiple requests. As far as the odd errors regarding closing the connection, I believe that PostgreSQL does a hard shutdown of the connection because it got what it considers an invalid message. So probably pgx doesn't know the connection is closed. |
I've added documentation to the |
I do not think we can really document this. I can do a PR to split reading and writing here if you would be OK with that?
I think it is a bit strange that messages are: {"database":"test","level":"LOG","msg":"invalid message length","pid":44,"time":"2024-01-04T20:42:04.533Z","user":"test","service":"postgresql","stage":"run","logged":"2024-01-04T20:42:04.533Z"}
{"database":"[unknown]","level":"LOG","msg":"PID 44 in cancel request did not match any process","pid":45,"time":"2024-01-04T20:42:04.537Z","user":"[unknown]","service":"postgresql","stage":"run","logged":"2024-01-04T20:42:04.537Z"} So pid 44 is connection which fails, but then it seems pgx sends the cancel over the connection with pid 45? Is this valid? |
Sure. I suggest making the max message size configurable from the tests though (maybe with a test that is in the pgx instead of pgx_test package). This would make it easier to test all the boundary conditions, make the tests faster, and avoid writing multiple GB to the storage device every time the tests are run.
Yes. Canceling requests requires creating a new connection just to trigger the cancellation. See https://www.postgresql.org/docs/current/protocol-flow.html#PROTOCOL-FLOW-CANCELING-REQUESTS. |
I made #1875. |
Describe the bug
I am unable to write 3 GB large object into the database.
To Reproduce
See this repository. Run:
Expected behavior
But large objects are correctly stored.
Actual behavior
The first (small) value is stored. The second (3 GB large value) is not. I get the error:
In PostgreSQL logs I can also see:
Version
Additional context
Interestingly, there is another error:
This happens because code calls
e.dbpool.Close()
always, even on error. And I am not sure why pgx tries to close a connection which does not exist anymore, it seems? At least this is how I am reading this log message.The text was updated successfully, but these errors were encountered: