hanoidb hangs, with unhandled messages in main_loop function in hanoidb_level.erl #39

Open
opened 2016-10-02 22:11:56 +00:00 by brigadier · 0 comments
brigadier commented 2016-10-02 22:11:56 +00:00 (Migrated from github.com)

I'm getting from time to time some unhandled messages in the main_loop function in hanoidb_level.erl
The messages are unhandled because guards fail to match on the certain State. For example:

{'$call',{<0.706.0>,#Ref<0.0.1.4643>},{begin_incremental_merge,1024}} %% with Ref in State#state.step_merge_ref
{'$reply',#Ref<0.0.3.18586>,step_ok} %% with Ref in State#state.step_merge_ref and in State#state.step_next_ref
{'$call',{<0.715.0>,#Ref<0.0.2.1442>},{begin_incremental_merge,1024}} %% with Ref in State#state.step_next_ref
{'$call',{<0.725.0>,#Ref<0.0.2.1441>},{step_level,0,1024}} %% with Ref in State#state.step_merge_ref
{'$call',{<0.713.0>,#Ref<0.0.8.53125>},{inject,"database/X-10.data"}} %% with State#state.c =/= undefined

Often after such message the app hangs on hanoidb:get()

Example of code which hangs with this https://github.com/brigadier/exampledb/blob/master/db.zip?raw=true database 100% of time:


Db0 = "ip2/db".

application:start(syntax_tools).
application:start(plain_fsm).   
application:start(hanoidb).    

{ok, Db0H} = hanoidb:open(Db0).

L = lists:seq(1, 1000).

F = fun(I) -> hanoidb:get(Db0H, integer_to_binary(I)), hanoidb:put(Db0H, integer_to_binary(I), <<"123">>) end.

F2 = fun() -> lists:foreach(F, L), erlang:display(ok) end.

F2().
F2().
F2(). %%hangs there
F2(). %%or there
F2(). %%or there
F2(). %%or there

There's no such problem in a very old version of hanoidb, with the old file format etc.

I'm getting from time to time some unhandled messages in the `main_loop` function in `hanoidb_level.erl` The messages are unhandled because guards fail to match on the certain `State`. For example: ``` erlang {'$call',{<0.706.0>,#Ref<0.0.1.4643>},{begin_incremental_merge,1024}} %% with Ref in State#state.step_merge_ref {'$reply',#Ref<0.0.3.18586>,step_ok} %% with Ref in State#state.step_merge_ref and in State#state.step_next_ref {'$call',{<0.715.0>,#Ref<0.0.2.1442>},{begin_incremental_merge,1024}} %% with Ref in State#state.step_next_ref {'$call',{<0.725.0>,#Ref<0.0.2.1441>},{step_level,0,1024}} %% with Ref in State#state.step_merge_ref {'$call',{<0.713.0>,#Ref<0.0.8.53125>},{inject,"database/X-10.data"}} %% with State#state.c =/= undefined ``` Often after such message the app hangs on `hanoidb:get()` Example of code which hangs with this https://github.com/brigadier/exampledb/blob/master/db.zip?raw=true database 100% of time: ``` erlang Db0 = "ip2/db". application:start(syntax_tools). application:start(plain_fsm). application:start(hanoidb). {ok, Db0H} = hanoidb:open(Db0). L = lists:seq(1, 1000). F = fun(I) -> hanoidb:get(Db0H, integer_to_binary(I)), hanoidb:put(Db0H, integer_to_binary(I), <<"123">>) end. F2 = fun() -> lists:foreach(F, L), erlang:display(ok) end. F2(). F2(). F2(). %%hangs there F2(). %%or there F2(). %%or there F2(). %%or there ``` There's no such problem in a very old version of hanoidb, with the old file format etc.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: greg/hanoidb#39
No description provided.