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 }}
Built-in monitoring & alerting for stuck / unprocessed envelopes #4936
A customer encountered an issue where their application silently stopped sending events to Sentry. After local investigation, they discovered a number of .envelope files accumulating in the SDK’s local Sentry folder including very large files (~2GB) and very old files (dating back to February).
After manually clearing the folder, the Sentry SDK immediately resumed normal operation.
To prevent this kind of silent failure, they are requesting a built-in mechanism in the Sentry SDK that can detect envelope backlogs and surface an alert or warning to the Sentry dashboard (or at least application logs) so teams can act before ingestion silently stops.
This is on JVM 21, Temurin runtime. Desktop I guess? I mean: we're running it on a server 😁.
We're using Java modules io.sentry:sentry and io.sentry:sentry-logback both version 8.26.0.
On Nov. 6th we switched from 8.23.0 to 8.25.0
On Nov. 18th we switched from 8.25.0 to 8.26.0
The oldest unsent .envelope file in the system was from February, so none of these versions was able to clean up the backlog. We noticed that Sentry stopped sending since we sent a "startup warning" every release in order to verify we didn't break anything. We release every week and upon inspection Sentry SDK stopped sending messages somewhere halfway the release.
Unfortunately, the engineer that worked on the production machine removed the envelopes instead of moving them for later inspection. So I can't tell you what was in the envelopes so you can reproduce.
Please let me know if we can be of any (further) assistance.
FYI, the envelopes all seem to be valid JSON to me (they parse as such), and a quick visual inspection didn't seem to indicate something wrong with these files.
Thank you for the additional information, @mhogerheijde.
My colleague @adinauer is currently OOO and will be back next Monday to continue looking into this.
In the meantime you can send me a couple of those envelopes via email at lorenzo.cian@sentry.io and I can quickly check whether they are valid.
@lcian thanks for the update. For us there is currently no rush or otherwise urgency on this. We've changed our monitoring to also look at the cache size and if it grows to much we get alerts.
I'll sent the captured envelopes to you soon.
Just to make sure, you did configure cacheDirPath, correct?
We do set cacheDirPath. Inside the container it is set to /etc/hiber/sentry. That path is mounted onto the docker host filesystem, so the cache directory is persisted across containers
@mhogerheijde I've reviewed one of your envelopes. The culprit (at least in that one), is a too large value in exceptions.values. That's an exception message that contains a very long SQL query.
The result is that Relay rejects the envelope with status 400.
Note that the envelope itself is not oversized, so I assume the SDK treats it differently from an oversized envelope, and ends up keeping it in the cache.
I'll leave it to @adinauer to determine the best path forward here as this seems related to the SDK truncation project we're working on.
@mhogerheijde I just took a look at the envelope files you sent and tried sending one of those into Sentry which worked for me.
I simply configured sentry.cache-dir-path=/Users/... and added:
It picked up the file, sent it to Sentry and it showed up in UI.
I'm assuming these files (except the large one) remained in cache dir because there was a temporary network issue, rate limit or similar.
I created a PR which will change the SDK to delete the cache files instead of retrying for 4xx and 5xx responses. This means your cache dir should no longer be filling up once the change has been released. Our intent here is to not overwhelm Sentry after an outage, after load shedding or by piling up envelopes that can't be ingested and are retried continuously.
If you would still like to see cases like the large query in Sentry, your best option is to implement the onOversizedEvent callback and truncate exception messages. I asked internally and we're careful with default truncations we put into the SDK since those have bitten us in the past. I do understand this can be frustrating - sorry!
Activity
linear commentedon Nov 27, 2025
JAVA-254
adinauer commentedon Dec 1, 2025
@dalnoki is this Android, JVM Desktop or something else?
mhogerheijde commentedon Dec 1, 2025
Hi, original reporter here.
This is on JVM 21, Temurin runtime. Desktop I guess? I mean: we're running it on a server 😁.
We're using Java modules
io.sentry:sentryandio.sentry:sentry-logbackboth version8.26.0.On Nov. 6th we switched from
8.23.0to8.25.0On Nov. 18th we switched from
8.25.0to8.26.0The oldest unsent
.envelopefile in the system was from February, so none of these versions was able to clean up the backlog. We noticed that Sentry stopped sending since we sent a "startup warning" every release in order to verify we didn't break anything. We release every week and upon inspection Sentry SDK stopped sending messages somewhere halfway the release.Unfortunately, the engineer that worked on the production machine removed the envelopes instead of moving them for later inspection. So I can't tell you what was in the envelopes so you can reproduce.
Please let me know if we can be of any (further) assistance.
adinauer commentedon Dec 1, 2025
Thanks for the additional details @mhogerheijde.
Just to make sure, you did configure
cacheDirPath, correct?Let me check if there's some cleanup we perform on Android but don't on JVM.
25 remaining items
mhogerheijde commentedon Dec 8, 2025
We had a restart of our server today, and we are left with 13 unsent envelopes:
server time is UTC.
Our backend is currently up-and-running. Sentry is reporting, but these envelopes are still lingering around in the queue. Current server time is
I can share the envelopes with you if you want, but since this is our production server, I'd rather not share those traces publicly.
mhogerheijde commentedon Dec 10, 2025
FYI, the envelopes all seem to be valid JSON to me (they parse as such), and a quick visual inspection didn't seem to indicate something wrong with these files.
lcian commentedon Dec 10, 2025
Thank you for the additional information, @mhogerheijde.
My colleague @adinauer is currently OOO and will be back next Monday to continue looking into this.
In the meantime you can send me a couple of those envelopes via email at lorenzo.cian@sentry.io and I can quickly check whether they are valid.
mhogerheijde commentedon Dec 10, 2025
@lcian thanks for the update. For us there is currently no rush or otherwise urgency on this. We've changed our monitoring to also look at the cache size and if it grows to much we get alerts.
I'll sent the captured envelopes to you soon.
We do set cacheDirPath. Inside the container it is set to
/etc/hiber/sentry. That path is mounted onto the docker host filesystem, so the cache directory is persisted across containerslcian commentedon Dec 11, 2025
@mhogerheijde I've reviewed one of your envelopes. The culprit (at least in that one), is a too large value in
exceptions.values. That's an exception message that contains a very long SQL query.The result is that Relay rejects the envelope with status 400.
Note that the envelope itself is not oversized, so I assume the SDK treats it differently from an oversized envelope, and ends up keeping it in the cache.
I'll leave it to @adinauer to determine the best path forward here as this seems related to the SDK truncation project we're working on.
adinauer commentedon Dec 16, 2025
@mhogerheijde I just took a look at the envelope files you sent and tried sending one of those into Sentry which worked for me.
I simply configured
sentry.cache-dir-path=/Users/...and added:It picked up the file, sent it to Sentry and it showed up in UI.
I'm assuming these files (except the large one) remained in cache dir because there was a temporary network issue, rate limit or similar.
I created a PR which will change the SDK to delete the cache files instead of retrying for 4xx and 5xx responses. This means your cache dir should no longer be filling up once the change has been released. Our intent here is to not overwhelm Sentry after an outage, after load shedding or by piling up envelopes that can't be ingested and are retried continuously.
If you would still like to see cases like the large query in Sentry, your best option is to implement the
onOversizedEventcallback and truncate exception messages. I asked internally and we're careful with default truncations we put into the SDK since those have bitten us in the past. I do understand this can be frustrating - sorry!Please let us know if you need more help.