Skip to content

Conversation

@masaori335
Copy link
Contributor

Fix #10555.

Prior to the change, when s3_auth plugin fall into the error with invalid config file, the handling TSAction _conf_rld_act is not cleared.

@masaori335 masaori335 added the s3_auth s3_auth plugin label Oct 3, 2023
@masaori335 masaori335 added this to the 10.0.0 milestone Oct 3, 2023
@masaori335 masaori335 requested a review from duke8253 October 3, 2023 02:00
@masaori335 masaori335 self-assigned this Oct 3, 2023
Dbg(dbg_ctl, "reloading configs");
S3Config *s3 = static_cast<S3Config *>(TSContDataGet(cont));
S3Config *s3 = static_cast<S3Config *>(TSContDataGet(cont));
std::unique_lock lock(s3->reload_mutex);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this function is calling many S3Config functions that modifies the s3 object, so acquiring the reload_mutex in the beginning seems better.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a shared mutex. It only protects the data changed by copy_changes_from().

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! I thought this is regular mutex...it'll be not simple fix. I'll rollback this change and let races go for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the race, @moonchen is writing up the issue and approaches.

@bryancall bryancall requested a review from ywkaras October 9, 2023 22:16
@bneradt
Copy link
Contributor

bneradt commented Oct 10, 2023

[approve ci autest]

S3Config *s3 = static_cast<S3Config *>(TSContDataGet(cont));
S3Config *s3 = static_cast<S3Config *>(TSContDataGet(cont));
std::unique_lock lock(s3->reload_mutex);
s3->check_current_action(edata);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you move this call to be first?

Copy link
Contributor Author

@masaori335 masaori335 Oct 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the main change. Prior to this change, the handling action is not cleared if the config is invalid ( returning without clearing the _conf_rld_action in line 1061 )
It makes S3Config holing the invalid pointer and try to cancel it on destructor.

@masaori335 masaori335 merged commit baeaf9a into apache:master Oct 15, 2023
@zwoop
Copy link
Contributor

zwoop commented Oct 16, 2023

Cherry-picked to v9.2.x

This has a trivial merge conflict due to TSDebug vs Dbg, which I resolved.

@zwoop zwoop modified the milestones: 10.0.0, 9.2.4 Oct 16, 2023
zwoop pushed a commit that referenced this pull request Oct 17, 2023
(cherry picked from commit baeaf9a)

 Conflicts:
	plugins/s3_auth/s3_auth.cc
traeak pushed a commit to traeak/trafficserver that referenced this pull request Dec 15, 2023
(cherry picked from commit baeaf9a)

 Conflicts:
	plugins/s3_auth/s3_auth.cc
masaori335 added a commit to masaori335/trafficserver that referenced this pull request Dec 10, 2024
apache#675)

(cherry picked from commit baeaf9a)

 Conflicts:
	plugins/s3_auth/s3_auth.cc

(cherry picked from commit 4afda66)

Co-authored-by: Masaori Koshiba <masaori@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Crash s3_auth s3_auth plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

s3_auth: crash on S3Config destructor

4 participants