Skip to content

Do not crash when object's contents is an empty list#1837

Merged
martinsumner merged 2 commits into
basho:develop-3.0from
efcasado:efcasado-riak_object-is_head-function_clause-error
Nov 23, 2022
Merged

Do not crash when object's contents is an empty list#1837
martinsumner merged 2 commits into
basho:develop-3.0from
efcasado:efcasado-riak_object-is_head-function_clause-error

Conversation

@efcasado

@efcasado efcasado commented Nov 19, 2022

Copy link
Copy Markdown
Contributor

Description

It is related to this known issue.

The issue, however, is that this case clause, which was introduced to be able to debug the issue, is never executed because riak_object:is_head/1 called in the case statement crashes due to the object's content being an empty list.

[error] <0.10284.7>@riak_core_vnode:vnode_command:376 riak_kv_vnode command failed {function_clause,[{lists,nth,[1,[]],[{file,"lists.erl"},{line,170}]},{riak_object,is_head,1,[{file,"/root/riak/rel/pkg/out/BUILD/riak-3.0.10-OTP22.3/_build/default/lib/riak_kv/src/riak_object.erl"},{line,352}]},{riak_kv_vnode,enforce_allow_mult,3,[{file,"/root/riak/rel/pkg/out/BUILD/riak-3.0.10-OTP22.3/_build/default/lib/riak_kv/src/riak_kv_vnode.erl"},{line,3123}]},{riak_kv_vnode,prepare_put_existing_object,6,[{file,"/root/riak/rel/pkg/out/BUILD/riak-3.0.10-OTP22.3/_build/default/lib/riak_kv/src/riak_kv_vnode.erl"},{line,2875}]},{riak_kv_vnode,do_put,7,[{file,"/root/riak/rel/pkg/out/BUILD/riak-3.0.10-OTP22.3/_build/default/lib/riak_kv/src/riak_kv_vnode.erl"},{line,2716}]},{riak_kv_vnode,handle_request,4,[{file,"/root/riak/rel/pkg/out/BUILD/riak-3.0.10-OTP22.3/_build/default/lib/riak_kv/src/riak_kv_vnode.erl"},{line,1489}]},{riak_core_vnode,vnode_command,3,[{file,"/root/riak/rel/pkg/out/BUILD/riak-3.0.10-OTP22.3/_build/default/lib/riak_core/src/riak_core_vnode.erl"},{line,373}]},{gen_fsm,handle_msg,8,[{file,"gen_fsm.erl"},{line,497}]}]}

@efcasado efcasado changed the title [WIP] Fix issue that crashes vnode worker when object contents is empty Do not crash when object's contents is an empty list Nov 19, 2022
@efcasado
efcasado force-pushed the efcasado-riak_object-is_head-function_clause-error branch from c3c3d50 to 12c91a5 Compare November 19, 2022 19:01
@martinsumner

Copy link
Copy Markdown
Contributor

Good spot, and thank-you for the contribution. I'm hoping to make a 3.0.12 release (including this fix) available in the next ten days.

@martinsumner
martinsumner merged commit 9ca7184 into basho:develop-3.0 Nov 23, 2022
martinsumner pushed a commit that referenced this pull request Dec 19, 2022
* Add test to illustrate issue

* Do not crash when object's contents is an empty list
martinsumner added a commit that referenced this pull request Dec 19, 2022
* Do not crash when object's contents is an empty list (#1837)

* Add test to illustrate issue

* Do not crash when object's contents is an empty list

* add missing function clause repair_keys_range in convert_fold (#1839)

* add missing function clause repair_keys_range in convert_fold, to unbreak aae_fold for that case

* thread converted aae_fold query in riak_client, to complete prev commit

* Change the default PR value from 0 to default (#1836)

This means that get requests will use bucket-type level Primary Read settings

Co-authored-by: Peter Tihanyi <[email protected]>

* Mas i1121 reip3 (#1838)

* Add reip/3

To allow for reip without loading the riak_core application

* Use alternate name

* Update riak_kv_console.erl

* Update riak_kv_console.erl

* reip_manual inputs are atoms

* Add warning to update riak.conf file after reip

* Make clear where attention is required

And return 'ok' to make clear the op was successful

* Update rebar.config

* Update log (#1840)

Make situation clearer in log

Rather than change behaviour, just make it clear that the warning can be ignored when shutting down.  This should avoid unnecessary concern.

* Update Readme, remove mercurial refs

Co-authored-by: Enrique Fernández <[email protected]>
Co-authored-by: Andrei Zavada <[email protected]>
Co-authored-by: Peter Tihanyi <[email protected]>
Co-authored-by: Peter Tihanyi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants