maria christakis national technical university of athens, greece joint work with kostis sagonas...
TRANSCRIPT
![Page 1: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/1.jpg)
Maria Christakis
National Technical University of Athens, GreeceJoint work with
Kostis Sagonas
Detection of Asynchronous Message Passing Errors Using Static Analysis
![Page 2: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/2.jpg)
Concurrency
![Page 3: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/3.jpg)
Interprocess communication
Synchronized shared structuresSynchronous message passing on typed channelsAsynchronous message passing
![Page 4: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/4.jpg)
Erlang
Strict, dynamically typed, functional
Concurrency model:User-level processesAsynchronous message passing
![Page 5: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/5.jpg)
Agenda
![Page 6: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/6.jpg)
Agenda
![Page 7: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/7.jpg)
Agenda
![Page 8: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/8.jpg)
Postman
Erlang VM
![Page 9: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/9.jpg)
House
Process
![Page 10: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/10.jpg)
Address
Process identifier
![Page 11: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/11.jpg)
Mailbox
Process mailbox
![Page 12: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/12.jpg)
Any valid Erlang term
![Page 13: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/13.jpg)
Building a house
Pid = spawn(Fun)
![Page 14: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/14.jpg)
Sending mail
Pid ! Msg
![Page 15: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/15.jpg)
Receiving mail
receive p1 -> e1; … pn -> en
end
![Page 16: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/16.jpg)
Receiving mail
receive p1 -> e1; … pn -> en
end
msg1
msg2
msg3
![Page 17: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/17.jpg)
Receive with no messages
Possible deadlock
![Page 18: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/18.jpg)
Receive of the wrong kind
Mailbox overflow
![Page 19: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/19.jpg)
Receive with unneeded patterns
Unreachable code or serious functionality issue
![Page 20: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/20.jpg)
Send nowhere received
Mailbox overflow
![Page 21: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/21.jpg)
Message passing example
-export([hello_world/0]).
hello_world() -> Self = self(), Fun = fun() -> world(Self) end, Pid = spawn(Fun), register(world, Pid), world ! hello.
world(Parent) -> receive hello -> Parent ! hi end.
![Page 22: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/22.jpg)
DIscrepancy AnaLYZer for ERlang
Static analysis tool for finding discrepancies
Type errors
Exception-raising code
Unsatisfiable conditions
Redundancies
Race conditions
Why Dialyzer?
![Page 23: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/23.jpg)
The analysis: pros
Sound for defect detection
![Page 24: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/24.jpg)
The analysis: pros
Automatic
![Page 25: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/25.jpg)
The analysis: pros
Fast and scalable
![Page 26: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/26.jpg)
The analysis: cons
Sound for defect detection
![Page 27: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/27.jpg)
The analysis: a 3-step process
![Page 28: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/28.jpg)
The analysis: a 3-step process
![Page 29: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/29.jpg)
The analysis: a 3-step process
![Page 30: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/30.jpg)
1. InformationCFGs
Escape analysis
Inter-modular call graph
Sharing/alias analysis
Type information
![Page 31: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/31.jpg)
1. Information
-export([hello_world/0]).
hello_world() -> Self = self(), Fun = fun() -> world(Self) end, Pid = spawn(Fun), register(world, Pid), world ! hello.
world(Parent) -> receive hello -> Parent ! hi end.
Call graph
![Page 32: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/32.jpg)
2. Communication graph
blah
![Page 33: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/33.jpg)
2. Communication graph
-export([hello_world/0]).
hello_world() -> Self = self(), Fun = fun() -> world(Self) end, Pid = spawn(Fun), register(world, Pid), world ! hello.
world(Parent) -> receive hello -> Parent ! hi end.
hel l o_wor l d/ 0 Fun
hel l o
hi
![Page 34: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/34.jpg)
3. Errors
-export([hello_world/0]).
hello_world() -> Self = self(), Fun = fun() -> world(Self) end, Pid = spawn(Fun), register(world, Pid), world ! hello.
world(Parent) -> receive hello -> Parent ! hi end.
The message will never be received
![Page 35: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/35.jpg)
3. Errors
No messages are sent to the process
receivereceive blah
![Page 36: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/36.jpg)
3. Errors
receive {A, 42} when is_atom(A) -> ok; foo -> …end
The pattern will never match messages sent to the process
Infimum: {gazonk, 42}
43
![Page 37: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/37.jpg)
Optimizations
Control-flow graph minimization
Avoiding repeated traversals
Avoiding redundant traversals
![Page 38: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/38.jpg)
False alarm avoidance
BIFsSharing/alias analysis
![Page 39: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/39.jpg)
False negatives
-export([hello_world/0]).
hello_world() -> Self = self(), Fun = fun() -> world(Self) end, Pid = spawn(Fun), register(world, Pid), world ! hello.
world(Parent) -> receive hello -> Parent ! hi, world(Parent) end.
![Page 40: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/40.jpg)
Experimental evaluation
![Page 41: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/41.jpg)
Performance
![Page 42: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/42.jpg)
Concluding remarks
![Page 43: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/43.jpg)
Future work
![Page 44: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/44.jpg)
Future work
![Page 45: Maria Christakis National Technical University of Athens, Greece Joint work with Kostis Sagonas Detection of Asynchronous Message Passing Errors Using](https://reader030.vdocument.in/reader030/viewer/2022032722/56649f4a5503460f94c6be3f/html5/thumbnails/45.jpg)
Future work