Opened 14 months ago

Last modified 14 months ago

#18576 new bug

Problems with locks after calling execvp with a program name that doesn't exist

Reported by: memecode Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: System/libroot.so Version: R1/beta4
Keywords: Cc: waddlesplash
Blocked By: Blocking:
Platform: x86-64

Description

R1/beta4 hrev56578+87 x86_64 running in VMWare on Windows

I start seeing these sorts of messages in one of my apps:

Unlocking BLocker with sem 240608 from wrong thread 9442, current holder -1 (see issue #6400).

After I attempt to execute sub-processes that don't exist using fork + execvp.

The code in question can be built and executed with the following commands:

hg clone https://phab.mallen.id.au/source/lgi/ code/lgi/trunk
cd code/lgi/trunk/lvc
ln -s haiku/Makefile.haiku makefile
make -j 6
./lvc

Once it's running, clicking the "Open Folder" button tends to trigger the error messages in the terminal.

The code that runs the sub-processes is in code/lgi/trunk/lvc/src/Main.cpp Specifically the GetVcsVersions class/thread and the minimal RunProcess function that wraps fork and exec.

In GetVcsVersions::Main make sure the list of VersionCtrl types[] has all 4 VCS systems enabled, including the ones that aren't installed. Typically on my system I have git (native) and hg (installed) but not svn and not cvs (haha).

When it tries and to run the missing vcs systems the problem appears.

This ticket came out of the discussion in this thread: https://discuss.haiku-os.org/t/unlocking-from-wrong-thread-how-do-i-break-on-this-msg/13911

Change History (3)

comment:1 by nephele, 14 months ago

Cc: waddlesplash added
Component: - GeneralSystem/libroot.so

comment:2 by waddlesplash, 14 months ago

Build doesn't work, fails with errors like these:

./src/haiku/File.cpp:464:5: error: no declaration matches 'int LVolume::Type() const'
  464 | int LVolume::Type() const
      |     ^~~~~~~
In file included from ./src/haiku/File.cpp:19:
./include/lgi/common/File.h:221:22: note: candidate is: 'LVolumeTypes LVolume::Type() const'
  221 |         LVolumeTypes Type() const;
      |                      ^~~~

comment:3 by memecode, 14 months ago

Sorry. It's an actively developed code base and not many other people use it. So it does break from time to time. But doesn't stay broken.

The build is now working for me... (revision 6542)

That said for future reference the state of the code when I reported this can be restored by: hg revert -r 6485 .

Note: See TracTickets for help on using tickets.