Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.kernel > #85539

Bug#1098226: linux-image-6.12.13-amd64: newfstatat syscall ENOENT failure in multithreaded program

From Vincent Lefevre <vincent@vinc17.net>
Newsgroups linux.debian.bugs.dist, linux.debian.kernel
Subject Bug#1098226: linux-image-6.12.13-amd64: newfstatat syscall ENOENT failure in multithreaded program
Date 2025-02-18 14:40 +0100
Message-ID <KhvZn-8YF-1@gated-at.bofh.it> (permalink)
References <KhiSu-hAta-1@gated-at.bofh.it> <KhvmF-8v9-19@gated-at.bofh.it> <Khvwl-8On-1@gated-at.bofh.it> <KhiSu-hAta-1@gated-at.bofh.it> <Khvwl-8On-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Cross-posted to 2 groups.

Show all headers | View raw


On 2025-02-18 14:07:36 +0100, Vincent Lefevre wrote:
> On 2025-02-18 13:49:18 +0100, Vincent Lefevre wrote:
> > FYI, I can also reproduce this issue on my Samsung Galaxy S23 Ultra
> > phone under Termux/Android. Similarly, running the Perl script with
> > "strace -f" also yields a lot of stat failures.
> 
> I can also reproduce it under macOS (cfarm104.cfarm.net), so I'm
> wondering whether the bug could actually be in Perl. But in any case,
> I don't understand how this couldn't be a bug in the Linux kernel,
> according to the strace output.

Hmm... There's a fchdir in the strace output. If the current directory
is global to the process, this could be an issue. I now really suspect
a bug in perl.

If I change my script to do

opendir DIR, $dir or die "$0: opendir failed ($!)\n";
my @files = readdir DIR;
foreach my $file (@files)
  {
    $nthreads < $maxthreads or join_threads;
    $nthreads++ < $maxthreads or die "$0: internal error\n";
    threads->create(\&stat_test, $file);
  }
closedir DIR or die "$0: closedir failed ($!)\n";

then the failures still occur.

But if I then move the closedir as follows

opendir DIR, $dir or die "$0: opendir failed ($!)\n";
my @files = readdir DIR;
closedir DIR or die "$0: closedir failed ($!)\n";
foreach my $file (@files)
  {
    $nthreads < $maxthreads or join_threads;
    $nthreads++ < $maxthreads or die "$0: internal error\n";
    threads->create(\&stat_test, $file);
  }

the failures no longer occur.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Pascaline project (LIP, ENS-Lyon)

Back to linux.debian.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Bug#1098226: linux-image-6.12.13-amd64: newfstatat syscall ENOENT failure in multithreaded program Vincent Lefevre <vincent@vinc17.net> - 2025-02-18 14:00 +0100
  Bug#1098226: linux-image-6.12.13-amd64: newfstatat syscall ENOENT failure in multithreaded program Vincent Lefevre <vincent@vinc17.net> - 2025-02-18 14:10 +0100
    Bug#1098226: linux-image-6.12.13-amd64: newfstatat syscall ENOENT failure in multithreaded program Vincent Lefevre <vincent@vinc17.net> - 2025-02-18 14:40 +0100
      Bug#1098226: perl: thread creation while a directory handle is open does a fchdir, affecting other threads Vincent Lefevre <vincent@vinc17.net> - 2025-02-18 17:10 +0100

csiph-web