Skip to content

Race conditions possible (installation + use of modules may happen at the same time) #71

@eserte

Description

@eserte

Today I got a mysterious failure when using cpm on a travis-ci system. The build log with the failure can be seen here: https://travis-ci.org/eserte/bbbike/jobs/198528696#L5531

The error message ("Getopt/Long.pm did not return a true value") and the fact that the installation of Getopt::Long is reported a few log lines later suggests that the failure was caused by a use Getopt::Long while the installation of Getopt/Long.pm was in progress, so the calling script saw an incomplete file.

This is a new failure class which cannot happen in traditional serial installers. I don't have a good idea how to solve this. First, this possible problem should probably be documented. A possible fix could be to make sure that the installation step happens when no other build/configure/test processes run in parallel, but this would mean to slow down the whole installation process. Another possibility is to let these errors happen, but retry automatically once (after all, I am using cpm since some months and it's the first such failure). Finally it would probably be better to have the installation process more atomic. Currently ExtUtils::Install does a copy() of modules, but it would be more robust to copy to a temporary file on the destination filesystem, and then do an atomic rename(). Still it is not a real transaction if many files belonging to a distribution are to be installed, but at least incomplete file reads could not happen anymore.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions