Skip to content

Conversation

@cmcfarlen
Copy link
Contributor

@cmcfarlen cmcfarlen commented Sep 15, 2023

I wonder if coverity is confused by following the current_req pointer for the unlock call vs my_aio_req for the lock. I removed the current_req variable as it isn't necessary.

I also moved the release call before incrementing metrics since the lock doesn't need to be held for that.

Fixes #10430

@cmcfarlen cmcfarlen self-assigned this Sep 15, 2023
@cmcfarlen cmcfarlen added this to the 10.0.0 milestone Sep 15, 2023
@bryancall bryancall requested a review from ywkaras September 18, 2023 22:13
num_requests--;
current_req->queued--;
ink_atomic_increment((int *)&current_req->pending, 1);
ink_atomic_increment((int *)&my_aio_req->pending, 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

You could get rid of the C-style cast.

@@ -423,17 +423,15 @@ ink_aio_thread_num_set(int thread_num)
void *
AIOThreadInfo::aio_thread_main(AIOThreadInfo *thr_info)
Copy link
Contributor

Choose a reason for hiding this comment

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

Not directly relevant to this PR, but thr_info is redundant, it's the same as the this pointer in this function.

@ywkaras
Copy link
Contributor

ywkaras commented Sep 19, 2023

The AIO code seems scary bad in general.

ink_atomic_increment(&current_req->requests_queued, -1);
ink_atomic_increment(&my_aio_req->requests_queued, -1);
#ifdef AIO_STATS
ink_atomic_increment((int *)&current_req->pending, -1);
Copy link
Contributor

Choose a reason for hiding this comment

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

It lives.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, I missed some inside the conditional code. Thanks!

ink_atomic_increment((int *)&current_req->pending, 1);
ink_atomic_increment((int *)&my_aio_req->pending, 1);
#endif
ink_mutex_release(&my_aio_req->aio_mutex);
Copy link
Contributor

Choose a reason for hiding this comment

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

Releasing early looks OK.

@cmcfarlen cmcfarlen requested a review from ywkaras September 19, 2023 10:49
@cmcfarlen cmcfarlen merged commit e1d3960 into apache:master Sep 19, 2023
@cmcfarlen cmcfarlen deleted the cid1508860 branch September 19, 2023 20:05
cmcfarlen pushed a commit to cmcfarlen/trafficserver that referenced this pull request Jun 3, 2024
* asf/master: (30 commits)
  add conveinience function to lookup name->IntType* (apache#10474)
  cmake: bigobj subdir has executables, not plugins (apache#10481)
  cmake: compile jsonrpc_protocol with -fPIC (apache#10478)
  Make sure new metrics are always considered (apache#10445)
  Refactor and rename restart metrics (apache#10472)
  Fix the SNI and HOST parsing properly (apache#10480)
  slice/Data.h: CID 1508924: Uninitialized scalar field (apache#10470)
  CID 1508882: initialize pointer (apache#10469)
  CID-1512726: Mute coverity, use explicit check for iterator use past end (apache#10467)
  Fix Coverity issue in inliner plugin. (apache#10442)
  Set the proper variable when find_package fails to find the package (apache#10468)
  CID1508860: double lock confusion (apache#10443)
  Stop using functions that are unavailable on the latest quiche (apache#10447)
  Add allow-plain server ports attribute (apache#9574)
  [Fuzzing] move build.sh in trafficserver (apache#10466)
  Some sort of "fix" to mute coverity. (apache#10451)
  CID-1512733: Fix coverity issue (apache#10452)
  Fix cmake autooptions (apache#10456)
  Cmake presets (apache#10457)
  This fixes CID 1518257 (apache#10404)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CID 1508860: Double lock

2 participants