Skip to content

box: fix crash while nil-uuid subscribe request#11593

Merged
sergepetrenko merged 1 commit intotarantool:masterfrom
mrForza:mrforza/gh-11531-crash-while-anonymous-subscribe-request
Jul 4, 2025
Merged

box: fix crash while nil-uuid subscribe request#11593
sergepetrenko merged 1 commit intotarantool:masterfrom
mrForza:mrforza/gh-11531-crash-while-anonymous-subscribe-request

Conversation

@mrForza
Copy link
Contributor

@mrForza mrForza commented Jun 20, 2025

Before this patch a master node could crash when it processed an
anonymous iproto subscribe request which had a nil instance uuid.
The reason of this error is that in box_connect_replica we didn't
throw an error when non-exist replica tried to connect to node. It
led to a situation when the nullified replica object was tried to
dereferenced while iproto subscribe request. Now, we raise an
ER_NIL_UUID error if we get an iproto request with nil instance_uuid.

After this change test_fetch_snapshot_no_uuid and
test_checkpoint_join start fail. The reason of these failures is an
incorrect err.type and err.msg of iproto response when we try to send
an iproto request with nil instance_uuid. Now, these tests are fixed
by changing an err.type and err.msg to appropriate values.

Also we change gh_10155_make_iproto_resistant_to_misusage test because
write_fetch_snapshot wasn't be able to send iproto fetch_snapshot
request with uuid. It led to situation when ER_NIL_UUID error was raised
during fetch_snapshot and as a result we weren't be able to read
snapshot after this. It broke
test_iproto_crash_fetch_snapshot_subscribe and
test_iproto_crash_fetch_snapshot_subscribe_not_anon.

Closes #11531

@mrForza mrForza requested a review from a team as a code owner June 20, 2025 12:02
@mrForza mrForza force-pushed the mrforza/gh-11531-crash-while-anonymous-subscribe-request branch from 1cf33da to fc34de4 Compare June 20, 2025 14:21
@coveralls
Copy link

coveralls commented Jun 20, 2025

Coverage Status

coverage: 87.543% (-0.02%) from 87.562%
when pulling 1545807 on mrForza:mrforza/gh-11531-crash-while-anonymous-subscribe-request
into 584c3e0
on tarantool:master
.

@sergepetrenko sergepetrenko self-assigned this Jun 23, 2025
@sergepetrenko sergepetrenko self-requested a review June 23, 2025 10:21
Copy link
Collaborator

@sergepetrenko sergepetrenko left a comment

Choose a reason for hiding this comment

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

Thanks for the fix!

Please find my comments below.

@mrForza mrForza force-pushed the mrforza/gh-11531-crash-while-anonymous-subscribe-request branch 2 times, most recently from f7f68fc to 5e8423c Compare July 1, 2025 15:11
@mrForza mrForza assigned Serpentian and sergepetrenko and unassigned mrForza Jul 1, 2025
@mrForza mrForza requested a review from sergepetrenko July 1, 2025 15:38
Copy link
Contributor

@Serpentian Serpentian left a comment

Choose a reason for hiding this comment

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

That's a good patch! I don't see any problems

@Serpentian Serpentian removed their assignment Jul 2, 2025
Copy link
Collaborator

@sergepetrenko sergepetrenko left a comment

Choose a reason for hiding this comment

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

Thanks for the fixes!
Let's fix the persistent_gc_anon_test and we'll be good to go.

Before this patch a master node could crash when it processed an
anonymous iproto subscribe request which had a nil instance uuid.
The reason of this error is that in `box_connect_replica` we didn't
throw an error when non-exist replica tried to connect to node. It
led to a situation when the nullified replica object was tried to
dereferenced while iproto subscribe request. Now, we raise an
ER_NIL_UUID error if we get an iproto request with nil `instance_uuid`.

After this change `test_fetch_snapshot_no_uuid` and
`test_checkpoint_join` start fail. The reason of these failures is an
incorrect err.type and err.msg of iproto response when we try to send
an iproto request with nil `instance_uuid`. Now, these tests are fixed
by changing an err.type and err.msg to appropriate values.

Also we change `gh_10155_make_iproto_resistant_to_misusage` test because
`write_fetch_snapshot` wasn't be able to send iproto fetch_snapshot
request with uuid. It led to situation when ER_NIL_UUID error was raised
during fetch_snapshot and as a result we weren't be able to read
snapshot after this. It broke
`test_iproto_crash_fetch_snapshot_subscribe` and
`test_iproto_crash_fetch_snapshot_subscribe_not_anon`.

Closes tarantool#11531

NO_DOC=bugfix
@mrForza mrForza force-pushed the mrforza/gh-11531-crash-while-anonymous-subscribe-request branch from 5e8423c to 1545807 Compare July 3, 2025 09:07
@mrForza mrForza assigned sergepetrenko and unassigned mrForza Jul 3, 2025
@mrForza mrForza requested a review from sergepetrenko July 3, 2025 09:36
@sergepetrenko sergepetrenko added the full-ci Enables all tests for a pull request label Jul 3, 2025
@sergepetrenko sergepetrenko added backport/3.2 Automatically create a 3.2 backport PR backport/3.3 Automatically create a 3.3 backport PR backport/3.4 Automatically create a 3.4 backport PR and removed full-ci Enables all tests for a pull request labels Jul 3, 2025
@sergepetrenko sergepetrenko merged commit 0ba7505 into tarantool:master Jul 4, 2025
62 of 80 checks passed
@TarantoolBot
Copy link
Collaborator

Backport failed for release/3.2, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin release/3.2
git worktree add -d .worktree/backport/release/3.2/11593 origin/release/3.2
cd .worktree/backport/release/3.2/11593
git switch --create backport/release/3.2/11593
git cherry-pick -x 0ba7505b9672ce32067e24fd7a0d31e022b1ef34

@TarantoolBot
Copy link
Collaborator

Successfully created backport PR for release/3.3:

@TarantoolBot
Copy link
Collaborator

Successfully created backport PR for release/3.4:

@TarantoolBot
Copy link
Collaborator

Backport summary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/3.2 Automatically create a 3.2 backport PR backport/3.3 Automatically create a 3.3 backport PR backport/3.4 Automatically create a 3.4 backport PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Master crashes when processing an anonymous subscribe request with a nil uuid

6 participants