Commit bbf4084
authored
fix: async jobs stuck in processing on marshal failure (#1907)
## Summary
Fixes async jobs that become stuck in "processing" state when JSON marshaling fails during job execution. Previously, marshal failures would cause the job to exit without updating its status, leaving it permanently in the processing state.
## Changes
- Added panic recovery mechanism to ensure async jobs always reach a terminal state even if unexpected panics occur
- Introduced `markFailed` helper function to consistently update job status to "failed" with appropriate error details
- Added explicit error handling for JSON marshal failures that now properly transition jobs to "failed" status instead of leaving them stuck
- Jobs that fail during error serialization or result serialization now get marked as failed with descriptive error messages
## Type of change
- [x] Bug fix
- [ ] Feature
- [ ] Refactor
- [ ] Documentation
- [ ] Chore/CI
## Affected areas
- [x] Core (Go)
- [ ] Transports (HTTP)
- [ ] Providers/Integrations
- [ ] Plugins
- [ ] UI (Next.js)
- [ ] Docs
## How to test
Test async job execution with marshal failures to verify jobs transition to failed state:
```sh
# Core/Transports
go version
go test ./...
# Test specific async job scenarios
go test ./framework/logstore -v -run TestAsyncJob
```
## Screenshots/Recordings
N/A
## Breaking changes
- [ ] Yes
- [x] No
## Related issues
N/A
## Security considerations
No security implications. This change improves system reliability by preventing jobs from being stuck in processing state.
## Checklist
- [ ] I read `docs/contributing/README.md` and followed the guidelines
- [ ] I added/updated tests where appropriate
- [ ] I updated documentation where needed
- [ ] I verified builds succeed (Go and UI)
- [ ] I verified the CI pipeline passes locally if applicable1 parent e3cdcdf commit bbf4084
2 files changed
+29
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
121 | 146 | | |
122 | 147 | | |
123 | 148 | | |
| |||
137 | 162 | | |
138 | 163 | | |
139 | 164 | | |
| 165 | + | |
140 | 166 | | |
141 | 167 | | |
142 | 168 | | |
| |||
158 | 184 | | |
159 | 185 | | |
160 | 186 | | |
| 187 | + | |
161 | 188 | | |
162 | 189 | | |
163 | 190 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
0 commit comments