Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 28, 2025

What is this PR about?

Database restore operations fail for large backups (hundreds of MBs) with stderr maxBuffer length exceeded. Node.js exec() defaults to 1MB buffer, insufficient for verbose restore output.

Changes:

  • Added MAX_EXEC_BUFFER_SIZE constant (100MB) to handle large backup operations
  • Updated execAsync() and execAsyncStream() to use 100MB maxBuffer with fallback support
  • Extended ExecOptions interface with optional maxBuffer property for override capability

This affects all database restore operations (MongoDB, PostgreSQL, MySQL, MariaDB) using these exec functions.

// Before: Default 1MB buffer causes failures on large restores
const result = await execAsyncBase(command, options);

// After: 100MB buffer with override support
const result = await execAsyncBase(command, {
  ...options,
  maxBuffer: options?.maxBuffer ?? MAX_EXEC_BUFFER_SIZE,
});

Checklist

Before submitting this PR, please make sure that:

Screenshots (if applicable)

N/A - Backend fix for command execution

Original prompt

This section details on the original issue you should resolve

<issue_title>MongoDB restore fails for large backups: stderr maxBuffer length exceeded</issue_title>
<issue_description>### To Reproduce

When attempting to restore a MongoDB backup from cloud storage in Dokploy, the restore fails with the following error:

Error: stderr maxBuffer length exceeded
  1. Create a MongoDB backup in Dokploy and store it on cloud storage (S3/GCS).
  2. Attempt to restore the backup to a MongoDB service in Dokploy.
  3. For large backups (hundreds of MBs), the restore fails with the above error.

Current vs. Expected behavior

Expected behavior

The backup should be restored successfully regardless of its size.

Actual behavior

The restore fails due to Node’s maxBuffer limit being exceeded when streaming the backup through the restore command.

Provide environment information

Operating System: OS: Ubuntu 24.04
Arch: x86_64 (Intel/AMD processor)
Dokploy version: v0.25.3
VPS Provider: Hetzner Cloud

Which area(s) are affected? (Select all that apply)

Databases

Are you deploying the applications where Dokploy is installed or on a remote server?

Same server where Dokploy is installed

Additional context

No response

Will you send a PR to fix it?

No</issue_description>

Comments on the Issue (you are @copilot in this section)

@Siumauricio I see the error. You can try the following: go to the advanced section -> danger zone -> then click on rebuild database. This will delete the database volume and recreate it. From there, you can try to restore it.

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits December 28, 2025 19:30
…up restores

Co-authored-by: Siumauricio <47042324+Siumauricio@users.noreply.github.com>
…ExecOptions interface

Co-authored-by: Siumauricio <47042324+Siumauricio@users.noreply.github.com>
…uffer

Co-authored-by: Siumauricio <47042324+Siumauricio@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix MongoDB restore failure for large backups Dec 28, 2025
Copilot AI requested a review from Siumauricio December 28, 2025 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants