fix: tolerate zip exit code 18 in web server backup#3854
Open
trex0r wants to merge 1 commit intoDokploy:canaryfrom
Open
fix: tolerate zip exit code 18 in web server backup#3854trex0r wants to merge 1 commit intoDokploy:canaryfrom
trex0r wants to merge 1 commit intoDokploy:canaryfrom
Conversation
Comment on lines
+75
to
+85
| try { | ||
| await execAsync( | ||
| `cd ${tempDir} && zip -r ${backupFileName} *.sql filesystem/ > /dev/null 2>&1`, | ||
| ); | ||
| } catch (error) { | ||
| // zip exit code 18 = "completed with warnings, some files not readable" | ||
| // This happens when sockets/pipes exist under /etc/dokploy/ — the archive is still valid | ||
| if (!(error instanceof ExecError && error.exitCode === 18)) { | ||
| throw error; | ||
| } | ||
| } |
Contributor
There was a problem hiding this comment.
Consider logging when exit code 18 occurs for better observability
Suggested change
| try { | |
| await execAsync( | |
| `cd ${tempDir} && zip -r ${backupFileName} *.sql filesystem/ > /dev/null 2>&1`, | |
| ); | |
| } catch (error) { | |
| // zip exit code 18 = "completed with warnings, some files not readable" | |
| // This happens when sockets/pipes exist under /etc/dokploy/ — the archive is still valid | |
| if (!(error instanceof ExecError && error.exitCode === 18)) { | |
| throw error; | |
| } | |
| } | |
| try { | |
| await execAsync( | |
| `cd ${tempDir} && zip -r ${backupFileName} *.sql filesystem/ > /dev/null 2>&1`, | |
| ); | |
| } catch (error) { | |
| // zip exit code 18 = "completed with warnings, some files not readable" | |
| // This happens when sockets/pipes exist under /etc/dokploy/ — the archive is still valid | |
| if (!(error instanceof ExecError && error.exitCode === 18)) { | |
| throw error; | |
| } | |
| writeStream.write("Backup completed with warnings (some files not readable)\n"); | |
| } |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses this issue: #3853
The
zipcommand exits with code 18 ("completed with warnings, some files not readable"), whichexecAsynctreats as a fatal error — even thoughThe fix is to wrap the zip
execAsynccall in a try/catch that tolerates exit code 18 specifically. All other non-zero exit codes still throw as beforeGreptile Summary
Wrapped the zip command in a try/catch block to specifically tolerate exit code 18 (warnings about unreadable files like sockets/pipes), allowing backups to succeed despite non-critical warnings. All other errors continue to be thrown as expected. The fix correctly imports
ExecErrorand uses proper instanceof checking with the exit code comparison.Confidence Score: 5/5
Last reviewed commit: 245ad90
(2/5) Greptile learns from your feedback when you react with thumbs up/down!