Description
Version
18.18.0 and 20.x.x
Platform
Linux iob-node20 6.2.16-5-pve #1 SMP PREEMPT_DYNAMIC PVE 6.2.16-6 (2023-07-25T15:33Z) x86_64 GNU/Linux
Subsystem
iobroker
What steps will reproduce the bug?
writestream into a cifs share
How often does it reproduce? Is there a required condition?
Error always occurs
What is the expected behavior? Why is that the expected behavior?
The file created with writestream should be written to the remote file system (CIFS share), but it is only 16Kb in size and corrupted
What do you see instead?
A corrupted file with 16Kb instead of about 5-10 Mb
Additional information
Hello all,
I hope you can help here... We use the package among other things for backups in the iobroker project and have with current node 20 versions and from node 18.18.0 problems with many users who write their backup directly with a CIFS mount on the Fritzbox NAS.
Currently, I am only aware of problems in connection with Fitzbox and CIFS.
It seems that all attempts since Node 18.18.0 have problems with "fs.createWriteStream" or with .pipe.
Locally on the system there are no problems. The error only occurs when the backup is to be written to the CIFS mount point.
Here is an excerpt of how the create of the backup is constructed.
return new Promise((resolve, reject) => {
const f = fs.createWriteStream(name);
f.on('finish', () => {
this.removeTempBackupDir();
resolve(path.normalize(name));
});
f.on('error', e => {
console.error(`host.${this.hostname} Cannot pack directory ${this.tmpDir}/backup: ${e.message}`);
reject(new IoBrokerError({ message: e.message, code: EXIT_CODES.CANNOT_GZIP_DIRECTORY }));
});
try {
tar.create({ gzip: true, cwd: `${this.tmpDir}/` }, ['backup']).pipe(f);
} catch (e) {
console.error(`host.${this.hostname} Cannot pack directory ${this.tmpDir}/backup: ${e.message}`);
reject(new IoBrokerError({ message: e.message, code: EXIT_CODES.CANNOT_GZIP_DIRECTORY }));
}
});