Comments (2)
Looking at the traces now I see that the lasp:query
call in step 1 blocks because the lasp_distribution_backend
process is already handling a different request - it's probably coming from a lasp:declare_dynamic
call.
from lasp.
I looked more at the traces and found the following call flows leading to this deadlock:
- A
partisan_peer_service_client
receives a TCP(?) message on a socket in ahandle_info
function. It decodes the message into{state, Tag, LocalState}
, callshandle_message
which will send a{connected, ...}
message to thepartisan_pluggable_peer_service_manager
process. - The
partisan_pluggable_peer_service_manager
receives the{connected, ...}
message in thehandle_info
function, callspartisan_peer_service_events:update
which will callgen_event:sync_notify
and blocks here until thepartisan_peer_service_events
process handles the notification. - The
partisan_peer_service_events
process receives theupdate
event in thehandle_event
function and will calllasp_membership:update_membership
(that's thecallback
in the state), which in turn eventually callslasp_distribution_backend:declare_dynamic
and blocks here until thelasp_distribution_backend
process handles the declaration. - The
lasp_distribution_backend
process receives the{declare_dynamic, ...}
call in thehandle_call
function, eventually calls alasp_storage_backend:get
and blocks here until thelasp_storage_backend
process handles the{get, ...}
call. The problem is that thelasp_storage_backend
process is blocked (see step 2 in the call flow below).
The other call flow:
- The
lasp_state_based_synchronization_backend
receives a{state_sync, ...}
message (I think it is received from a timer), calls theinit_state_sync
function which callslasp_storage_backend:fold
and it blocks here until the call returns. - The
lasp_storage_backend
process receives a{fold, Function, ...}
request whereFunction
is the function created inlasp_state_based_synchronization_backend:init_state_sync
. Then eventually callslasp_ets_storage_backend:fold
with the same function and blocks here until the call returns. - The
lasp_ets_storage_backend
process receives the{fold, Function, ...}
request and callsets:fold(Function, ...)
which will call the inline function fromlasp_state_based_synchronization_backend:init_state_sync
. This anonymous function callslasp_synchronization_backend:send
which will callpartisan_pluggable_peer_service_manager:cast_message
. Despite it's name this function ends up doing agen_server:call
on thepartisan_pluggable_peer_service_manager
process, but that's blocked (see step 2 in the above call flow).
So it looks like the race is between two flows: an external TCP packet triggers a partisan_pluggable_peer_service_manager
-> lasp_storage_backend
chain (see the first flow above), while a scheduled {state_sync, ...}
message triggers a lasp_storage_backend
-> partisan_pluggable_peer_service_manager
chain (see the second flow above). If these happen about the same time, we have the deadlock.
I don't know what these flows supposed to do, my guess based on variable and function names is that both want to update some kind of internal state, who are in the cluster. I looked into the '[email protected]'
ets table in a different run and saw this:
[{{<<"_membership">>,lwwregister},
{dv,{state_lwwregister,{1611854259,
['[email protected]',
'[email protected]',
'[email protected]']}},
[],[],[],lwwregister,
[{clock,[{<<112,81,31,35,249,226,203,99,138,234,42,146,124,20,143,158,12,
185,230,4>>,
9}]},
{dynamic,true}],
0,[],[]}}]
so it looks line host2
is missing (maybe that's being added).
from lasp.
Related Issues (20)
- upgrade to latest gen_flow HOT 3
- enforce_once triggering more than expected HOT 3
- Can't use in an Elixir mix project HOT 12
- Lasp.stream/2 callbacks are not invoked when state_orset changes HOT 2
- Provide an option to trigger sync on update HOT 1
- Allow to force gossip to syncrhonize HOT 2
- Tree based dissemination mode is crashing. HOT 1
- peer service gossips to all members HOT 1
- Deltas don't support blocking sync option HOT 1
- Deltas don't support forced propagation option HOT 1
- Make it possible to undeclare variables HOT 13
- Syncing initial state or state after a crash where state is lost
- Fail to Compile: Getting log of git dependency failed in /dir/to/lasp-master/. Falling back to version 0.0.0 HOT 9
- Using the lasp-erlang-client? HOT 18
- Erlang 21 incompatible HOT 4
- Delayed lasp:stream function call
- Read with threshold and maximum blocking duration HOT 1
- Memory leak ? HOT 10
- Website is down HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lasp.