You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
No timeout on external storage writes causes DB connection exhaustion risk #909
When an attachment is created, the content stream is written to external storage (OSS, filesystem, or database) synchronously inside the open CAP database transaction. There is no timeout on this write operation.
This means a slow client upload, a large file being transferred slowly, or a hanging connection to an external storage service (e.g. the OSS endpoint) will hold a database connection open for the entire duration. Under load, this can exhaust the database connection pool.
The file size limit (defaultMaxSize, enforced by CountingInputStream) bounds the total bytes but does nothing against a client that trickles data slowly or an external service that hangs mid-upload.
Affected code
CreateAttachmentEvent.processEvent — calls attachmentService.createAttachment(...) synchronously inside the transaction (no timeout)
OSSAttachmentsServiceHandler.createAttachment — calls osClient.uploadContent(...).get(), a blocking call with no timeout configured
No timeout is set anywhere in storage-targets/cds-feature-attachments-oss on the underlying HTTP client
Expected behaviour
Long-running or hung writes to external storage should time out and release the database connection, rather than holding it indefinitely.
Possible mitigations
Configure a read/write timeout on the HTTP client used by the OSS SDK
Decouple the external storage write from the DB transaction (though this has trade-offs for consistency and is non-trivial given the InputStream cannot be outboxed)
Activity