- Issue created by @tedbow
- ๐บ๐ธUnited States tedbow Ithaca, NY, USA
just hit this again https://www.drupal.org/pift-ci-job/2586929 โ
re-running tests made it pass
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
in this issue change drupalci.yml to run `WritableFileSystemValidatorTest` many times and see if it fails randomly
๐ฏ
- Assigned to omkar.podey
- @omkarpodey opened merge request.
- ๐บ๐ธUnited States tedbow Ithaca, NY, USA
@omkar.podey thanks I think that is about 5 fails out of 100 https://dispatcher.drupalci.org/job/drupal8_contrib_patches/143858/console
Not good ๐
- ๐ฎ๐ณIndia omkar.podey
It did fail randomly the error i can see is while
$this->inspector->getConfig('minimum-stability', $dir);
and some how we getPHP
as a value.Attached a screenshot below
- ๐ฎ๐ณIndia omkar.podey
Now i'm wondering if the changes i pulled from 8.x-2.x made it consistently pass somehow ?
- ๐ฎ๐ณIndia omkar.podey
This proves that with the changes from 8.x-2.x the tests are consistently passing, we can see different errors before and after merge (both cases without the check
($type === ProcessOutputCallbackInterface::OUT)
) - Assigned to tedbow
- Status changed to Needs review
almost 2 years ago 1:29pm 9 February 2023 - ๐ฎ๐ณIndia omkar.podey
The conclusion for now,
- The tests are passing consistently now after pulling the changes from 8.x-2.x
- Leaving this issue open for now, if the inconsistencies surface again, I also saw some more issues but they seem to be fixed by the changes pulled from 8.x-2.x
- Unassigning and setting to active
- Issue was unassigned.
- Status changed to Active
almost 2 years ago 5:46am 10 February 2023 - ๐ฎ๐ณIndia yash.rode pune
I got this error on #3343889-17: Drop support for end-of-life versions of Composer โ on DrupalCI while I was not able to reproduce it on my local, re-running the test solved it for me.
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Yep โ all you can do for now is re-running it. That's why it's a random failure!
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Per https://stackoverflow.com/a/57381161 this is perhaps happening because DrupalCI's
/tmp
is full? ๐คAlso: AFAICT this started happening since ๐ Improve test DX *and* confidence: stop using VFS Fixed .
- @wim-leers opened merge request.
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Closed the
8.x-2.x
MR in favor of a new3.0.x
one. Moved all changes.And then added more debug output.
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
00:02:15.868 php -r 'print sys_get_temp_dir() . "\n";' 00:02:15.945 /tmp
yetโฆ
00:02:16.055 sys_temp_dir => no value => no value
Does that mean we can fix this by simply doing
ini_set('sys_temp_dir', $some_directory_we_created)
? ๐ค - ๐ฎ๐ณIndia omkar.podey
the problem might be with the permissions
chmod 1777 the_tmp_directory
might work - ๐ฎ๐ณIndia omkar.podey
the open_base_dir is also empty
open_basedir => no value => no value
so just creatingmkdir /var/www/tmp
and changing permissionschmod 1777 /var/www/tmp
maybe needssudo
? - ๐ฎ๐ณIndia omkar.podey
Retesting to see if it actually helped or was just a fluke
- ๐ฎ๐ณIndia omkar.podey
The tmp directory in not getting set
mkdir /var/www/tmp 15:15:58 chmod 1777 /var/www/tmp 15:15:58 php -r 'ini_set("sys_temp_dir", "/var/www/tmp");' 15:15:58 php -r 'print sys_get_temp_dir() . "\n";' 15:15:58 /tmp
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
This is now hypercritical. The failure frequency is higher. Probably because we run more
composer
commands now. - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
I guess it makes sense that calling
ini_set('sys_temp_dir', โฆ)
does not help because the error message is occurring insidecomposer
's\Composer\Console\Application::doRun()
:// Check system temp folder for usability as it can cause weird runtime issues otherwise Silencer::call(static function () use ($io): void { $tempfile = sys_get_temp_dir() . '/temp-' . md5(microtime()); if (!(file_put_contents($tempfile, __FILE__) && (file_get_contents($tempfile) === __FILE__) && unlink($tempfile) && !file_exists($tempfile))) { $io->writeError(sprintf('<error>PHP temp directory (%s) does not exist or is not writable to Composer. Set sys_temp_dir in your php.ini</error>', sys_get_temp_dir())); } });
โ I bet that this is happening because we run tests with a high level of concurrency on DrupalCI, and that would make it _feasible_ that
sys_get_temp_dir() . '/temp-' . md5(microtime());
runs at the exact same time in concurrent tests โ a race condition! - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
๐ #28 means that #3345222 would help a LOT (but still would not solve it entirely): #3345222-4: Optimize Composer calls in Fixture Manipulator โ .
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
๐ต๏ธโโ๏ธ The Composer code quoted in #28 was added in https://github.com/composer/composer/commit/28e9193e9ebde743c19f334a7294... almost 7 years ago. It was refined a few days later in https://github.com/composer/composer/commit/43eb471ec293822d377b618a4a14... and it's remained the same since then (other than non-semantical changes).
- Assigned to wim leers
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
We could ask Composer to adopt
hrtime()
(TIL!) instead, that would make the chances of a collision far lower (microseconds vs nanoseconds).But that will take time, which we don't have.
What if we can at runtime configure a unique temp dir? A quick experiment with a
test.ini
file like this:[PHP] sys_temp_dir = "/tmp/PID"
yields
$ php -c test.ini -r 'print sys_get_temp_dir() . "\n";' /tmp/PID
๐ฅณ
- Issue was unassigned.
- Status changed to Needs review
over 1 year ago 12:19pm 10 March 2023 - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Well I was very pleasantly surprised to discover
\Drupal\package_manager\ProcessFactory
โ without that we might have had to makecomposer-stager
modify its\PhpTuf\ComposerStager\Infrastructure\Service\ProcessRunner\AbstractRunner
! ๐Let's see how this faresโฆ ๐ค
- Status changed to RTBC
over 1 year ago 12:48pm 10 March 2023 - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
While there is an ~80% failure rate today in kernel tests (in the sense that a test run is very likely to have at least one kernel test fail with the error in this issue's title), this one immediately passed โฆ so โฆ that suggests that #3 actually fixes this ๐
Queuing a second one to confirmโฆ but I'm optimistic! ๐
I will land this without review from others because pretty much everyone reported being constantly blocked by this. Plus, the changes are very isolated, trivial to revert!
The last submitted patch, 33: 3338789-33.patch, failed testing. View results โ
- Status changed to Needs review
over 1 year ago 1:00pm 10 March 2023 - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Yep, another all-green
Kernel
test suite run!But โฆ build & functional tests failed hard:
Exception: Warning: mkdir(): File exists Drupal\package_manager\ProcessFactory->create()() (Line: 79)
I think that's easy to fix though ๐ค
- ๐บ๐ธUnited States phenaproxima Massachusetts
Due to the agreed hypercriticality (!) of this issue, I'm okay merging whatever fixes it post-haste without review. Consider this a "blanket RTBC".
- Status changed to RTBC
over 1 year ago 1:28pm 10 March 2023 -
Wim Leers โ
committed 5f98fb2f on 3.0.x
Issue #3338789 by omkar.podey, Wim Leers: Random failure: "PHP temp...
-
Wim Leers โ
committed 5f98fb2f on 3.0.x
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Both green, committed! ๐ข
- Status changed to Fixed
over 1 year ago 1:32pm 10 March 2023 - ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Now filed upstream PR with Composer to hopefully get it fixed there: https://github.com/composer/composer/pull/11375 ๐ค
Automatically closed - issue fixed for 2 weeks with no activity.