Solution for Riak 500 Internal Server Error
I am new to Riak and learning it. Few days ago, I got 500 Internal Server Error
exception while inserting data in a Riak bucket. It was weird because I was able to insert same data in different bucket.
I tried to find out root cause, but didn't get success. After beating my head whole day, I posted it on Roak forum and stackoverflow. I got a response that issue is related to precommit hook. But still I didn't get solution.
I didn’t make any change in Riak setting. I was not able to understand how this precommit was defined with the bucket.
I tried to overwrite precommit property of my bucket. Like this:-
[code language=”java”]
curl http://127.0.0.1:8098/riak/abc-client -X PUT -H “Content-Type: application/json” -d ‘{“props”:{“precommit”:[]}}’
[/code]
I tried again to insert data and got same error again.
[code language=”java”]
[error] ! step error
[error] RiakRetryFailedException: com.basho.riak.client.http.response.RiakResponseRuntimeException: 500 Internal Server Error<h1>Internal Server Error</h1>The server encountered an error while processing this request:<br><pre>{error,
[error] {error,badarg,
[error] [{erlang,iolist_to_binary,
[error] [{hook_crashed,{riak_search_kv_hook,precommit,error,badarg}}],
[error] []},
[error] {wrq,append_to_response_body,2,[{file,”src/wrq.erl”},{line,215}]},
[error] {riak_kv_wm_object,handle_common_error,3,
[error] [{file,”src/riak_kv_wm_object.erl”},{line,1144}]},
[error] {webmachine_resource,resource_call,3,
[error] [{file,”src/webmachine_resource.erl”},{line,186}]},
[error] {webmachine_resource,do,3,
[error] [{file,”src/webmachine_resource.erl”},{line,142}]},
[error] {webmachine_decision_core,resource_call,1,
[error] [{file,”src/webmachine_decision_core.erl”},{line,48}]},
[error] {webmachine_decision_core,accept_helper,1,
[error] [{file,”src/webmachine_decision_core.erl”},{line,612}]},
[error] {webmachine_decision_core,decision,1,
[error] [{file,”src/webmachine_decision_core.erl”},{line,580}]}]}}</pre><P><HR><ADDRESS>mochiweb+webmachine web server</ADDRESS> (DefaultRetrier.java:81)
[/code]
I found one more solution. I added a file advanced.config
, where riak.conf
is located, and below property
[code language=”java”]
[
{riak_search, [{enabled, true}]}
].
[/code]
I restarted riak. This time my problem was resolved. Now I am able to add data in bucket successfully.