Skip to content

Reliability issues when writing multiple files at the same time #96

@DevMcC

Description

@DevMcC

Hi, we've been working on an export, which should export 5 files (relatively at the same time).

However we've been experiencing some reliability issues, sometimes a file is being fully written, sometimes not and sometimes the export just gets stuck.
We're running every test with the same data, but we get different results every time. This issue is especially noticable for OSX, but we're now experiencing the same issue with Linux.

The way we have written it in the code is like this:

public function export(FilesystemInterface $filesystem, File $file): PromiseInterface
{
    return new Promise(function (callable $resolve) use ($filesystem, $file) {
        $fullPath = $this->fullPath($file);
        $filesystem->file($fullPath)->open('cwt')->then(function ($stream) use ($resolve, $file) {
            // This part is simplified, just to show an example.
            foreach ($file->lines() as $line) {
                $stream->write($this->format($line));
            }
            $stream->end();
            $resolve();
        });
    });
}

This method gets called 5 times, we collect all the promises and then we start the export with \Clue\React\Block\awaitAll($promises, $loop);.

Is it possible to write multiple files at the same time? Are we doing something wrong here?

Update: We've temporarily modified the export to only export one file, but even this seems to not work. Even on Linux we're experiencing more misfires now, the files are just empty.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions