Project

General

Profile

Bug #200

Segmentation fault with libprelude Python bindings and signal handling

Added by almost 13 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
Normal
Target version:
Start date:
Due date:
% Done:

0%

Resolution:
fixed

Description

The following piece of python code is intended to print "Message received" everytime a new alert is received by the Prelude Manager. It works ok, but sending a signal to it (e.g. SIGINT) in order for it stop leads to a segmentation fault.

Signal handling seems to be responsible for this. Other means to stop the python process (e.g. by sending a special IDMEF message to it) work fine.

import time
import prelude
import sys

def correlator_stop(signum, frame):
    prelude.prelude_client_destroy(client,prelude.PRELUDE_CLIENT_EXIT_STATUS_SUCCESS )
    print "Stop" 
    sys.exit()

signal.signal(signal.SIGINT, correlator_stop)

prelude.prelude_init(1, [[PythonTest]])
client = prelude.prelude_client_new("PythonTest") 

prelude.prelude_client_set_required_permission(client, prelude.PRELUDE_CONNECTION_PERMISSION_IDMEF_READ|prelude.PRELUDE_CONNECTION_PERMISSION_IDMEF_WRITE);

prelude.prelude_client_start(client);

pool = prelude.prelude_client_get_connection_pool(client)

while 1 :
    msg = prelude.prelude_connection_pool_recv(pool, -1)
    print "Message received" 

History

#1 Updated by Yoann VANDOORSELAERE almost 13 years ago

  • Status changed from New to Assigned

#2 Updated by Yoann VANDOORSELAERE over 12 years ago

  • Status changed from Assigned to Closed
  • Resolution set to fixed

(In r8819) Make sure we have an exception to process. This fix a crash with Python bindings upon signal reception. Fix #200.

#3 Updated by Yoann VANDOORSELAERE over 10 years ago

  • Project changed from PRELUDE SIEM to Libprelude
  • Category deleted (1)
  • Target version deleted (0.9.13)

Also available in: Atom PDF