forked from ooici/ioncore-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcrash_test_scri.py
More file actions
25 lines (20 loc) · 860 Bytes
/
crash_test_scri.py
File metadata and controls
25 lines (20 loc) · 860 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"""
Container Crash Demonstration
This script will perform an operation on the messaging client that results
in a fatal error (the client connection closes).
The container catches the error, stops the reactor, and the twistd process
then exits.
Unfortunately, there is no way to have the twistd process exit with a code
other than 0. This is a known Twisted issue.
Usage:
twistd -n cc crash_test_scri.py
"""
from ion.core.ioninit import container_instance as cc #Barf...I'm using the thing I despise
# It's like getting caught watching Jersey Shore
m = cc.exchange_manager.message_space
ch = m.connection._connection.channel()
d = ch.channel_open() # Open a channel once..that's good
def crash_operation(result, ch):
print 'Hold on to you butts!!!'
ch.channel_open() # Open the same channel twice...Bye Bye!
d.addCallback(crash_operation, ch)