-
-
Notifications
You must be signed in to change notification settings - Fork 240
Closed
Labels
CLIProduct areaProduct area
Description
Description
I encountered this code while trying to write an integration test which simulated server responses.
In this code:
sentry-cli/src/commands/build/upload.rs
Lines 564 to 600 in 1886edc
| &ChunkedBuildRequest { | |
| checksum, | |
| chunks: &checksums, | |
| build_configuration, | |
| release_notes, | |
| vcs_info, | |
| }, | |
| )?; | |
| chunks.retain(|Chunk((digest, _))| response.missing_chunks.contains(digest)); | |
| if !chunks.is_empty() { | |
| let upload_progress_style = ProgressStyle::default_bar().template( | |
| "{prefix:.dim} Uploading files...\ | |
| \n{wide_bar} {bytes}/{total_bytes} ({eta})", | |
| ); | |
| upload_chunks(&chunks, &chunk_upload_options, upload_progress_style)?; | |
| } | |
| // state.is_err() is not the same as this since it also returns | |
| // true for ChunkedFileState::NotFound. | |
| if response.state == ChunkedFileState::Error { | |
| let message = response.detail.as_deref().unwrap_or("unknown error"); | |
| bail!("Failed to process uploaded files: {message}"); | |
| } | |
| if let Some(artifact_url) = response.artifact_url { | |
| break Ok(artifact_url); | |
| } | |
| if response.state.is_finished() { | |
| bail!("File upload is_finished() but did not succeeded or error"); | |
| } | |
| }; | |
| result | |
| } | |
If the backend's assemble endpoint only ever returns a "created" response, and this response lacks an "artifact_url" (which could happen if we ever remove this field from the server's responses in the future for whatever reason), we will get stuck in an infinite loop.
Two thoughts:
- The final
ifstatement should also check if we return "created", not just "Error" or "OK" - There needs to be some sort of timeout and/or maximum iteration count on this loop, so that it is impossible to get stuck in an infinite loop.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
CLIProduct areaProduct area
Fields
Give feedbackNo fields configured for issues without a type.