Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempting to join an already joined thread at axel.c #411

Open
hcantunc opened this issue Sep 12, 2023 · 0 comments
Open

Attempting to join an already joined thread at axel.c #411

hcantunc opened this issue Sep 12, 2023 · 0 comments
Assignees
Labels
Milestone

Comments

@hcantunc
Copy link

Hello,

My bug detector tool found a concurrency issue in axel version 2.17.11, where a thread that has already been joined is attempted to be joined again. Below please find the detailed report.

At axel.c line 672 the first join occurs.

...
if (axel_gettime() > (axel->conn[i].last_transfer +
			axel->conf->reconnect_delay)) {
	pthread_cancel(*axel->conn[i].setup_thread);
	axel->conn[i].state = false;
	pthread_join(*axel->conn[i].
				setup_thread, NULL);
}

However, in axel.c line 643, it is still possible to call the pthread_join on the same thread that was joined before.

...
if (!axel->conn[i].state) {
	// Wait for termination of this thread
	pthread_join(*(axel->conn[i].setup_thread),
				NULL);
}

This behavior is non-deterministic and is not always present. However, I can reproduce this behavior deterministically by putting a short sleep statement before the lock acquire event in axel.c line 835. I presumed that this is not an intended behavior. Would you be able to confirm the validity of this issue?

Thank you.

@ismaell ismaell added the bug label Feb 6, 2024
@ismaell ismaell self-assigned this Feb 6, 2024
@ismaell ismaell added this to the v2.17.14 milestone Feb 6, 2024
@ismaell ismaell modified the milestones: v2.17.14, v2.17.15 Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants