Opened 9 years ago
Closed 5 months ago
#12703 closed bug (fixed)
Anomalous/incorrect behavior of get_team_info() in conjunction with start_watching_system()
Reported by: | anevilyak | Owned by: | bonefish |
---|---|---|---|
Priority: | normal | Milestone: | R1/beta5 |
Component: | System/Kernel | Version: | R1/Development |
Keywords: | Cc: | axeld | |
Blocked By: | Blocking: | ||
Platform: | All |
Description
In order to monitor teams being created/destroyed as part of some Debugger-related refactoring, I set up some code that uses the private start/stop_watching_system() APIs to be notified of those events, as be_roster only covers BApplications, and cannot be relied upon in the CLI case anyways.
However, something appears to be not entirely correct here, as there seems to be a relatively reliably reproducible case where the notifications arrives that a new team was created, and then turning around to retrieve the corresponding team's info succeeds, but the team_info struct in question only has the team_id itself filled in. The args are empty, image and thread count are 0 (though argc is surprisingly 1), and as such it's impossible to determine from said info what the launched app actually was. Waiting for a bit and requesting the info succeeds though, so it seems there's some race here on the kernel side. Attached a testcase that can relatively easily reproduce the problem. It can be compiled from the root of the Haiku tree using:
g++ -g testcase.cpp -Iheaders/private/system -Iheaders/private/kernel -o testcase -lroot
Running the program and then simply creating new Terminals repeatedly using the cmd+n Terminal shortcut will relatively reliably trigger it within 3-4 new Terminals here, and the code in question is set up to trigger a debugger call when the issue is detected. Interestingly, the actual team that exhibits the problem is quite reliably the one belonging to the newly created Terminal app itself, none of the bash, etc. subprocesses appear to wind up being affected.
Attachments (1)
Change History (5)
by , 9 years ago
Attachment: | testcase.cpp added |
---|
comment:1 by , 6 months ago
I would've thought hrev51700 would have fixed this, but apparently it did not, because the problem does still reproduce on a current nightly.
comment:2 by , 6 months ago
Hmm, it appears the team args are set rather late, in team_create_thread_start_internal, not too long before userspace entry. Should we move this to be earlier?
It does appear that the team name is at least filled in at the point the notification comes through ("Terminal").
comment:4 by , 5 months ago
Milestone: | Unscheduled → R1/beta5 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Fix merged in hrev57758.
Test program to reproduce issue