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:-

curl http://127.0.0.1:8098/riak/abc-client -X PUT -H "Content-Type: application/json" -d '{"props":{"precommit":[]}}'

I tried again to insert data and got same error again.

[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)

I found one more solution. I added a file advanced.config, where riak.conf is located, and below property

[
    {riak_search, [{enabled, true}]}
].

I restarted riak. This time my problem was resolved. Now I am able to add data in bucket successfully.

Advertisements

About Ayush Mishra

Ayush is the Sr. Software Consultant @ Knoldus Software LLP. In his 5 years of experience he has become developer with proven experience in architecting and developing web applications. Ayush has a Masters in Computer Application from U.P. Technical University, Ayush is a strong-willed and self-motivated professional who takes deep care in adhering to quality norms within projects. He is capable of managing challenging projects with remarkable deadline sensitivity without compromising code quality. .
This entry was posted in MongoDB, NoSql and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s