project8 / mantis

project8 development DAQ
Other
2 stars 1 forks source link

Mantis server crashes on invalid output file #46

Closed laroque closed 9 years ago

laroque commented 9 years ago

Rather than aborting and returning to a valid state of waiting for requests, the mantis_server crashes when unable to create the requested output file. I would have expected the former behavior. It looks like we should just be able to catch that exception but I'm not sure where or how we inform the user that there was a problem.

Reproduction

Start mantis_server and then add and activate a test digitizer. Request a run as follows: ➭ dripline_agent run mantis file=~laroque/foofile.egg

Notes

I tested with a well formatted path and it produced an output file as expected ➭ dripline_agent run mantis file=/Users/laroque/foofile.egg

Observed Output

17:59:49 [ INFO] server_worker.cc(64): Processing run request from queue
17:59:49 [ INFO] server_worker.cc(71): Initializing
17:59:49 [ INFO] server_worker.cc(82): Creating writer
17:59:49 [ INFO] t_file_writer.cc(54): opening file...
HDF5-DIAG: Error detected in HDF5 (1.8.14) thread 0:
  #000: H5F.c line 522 in H5Fcreate(): unable to create file
    major: File accessibilty
    minor: Unable to open file
  #001: H5Fint.c line 1001 in H5F_open(): unable to open file: time = Sat May 30 10:59:49 2015
, name = '~laroque/foofile.egg', tent_flags = 13
    major: File accessibilty
    minor: Unable to open file
  #002: H5FD.c line 992 in H5FD_open(): open failed
    major: Virtual File Layer
    minor: Unable to initialize object
  #003: H5FDsec2.c line 343 in H5FD_sec2_open(): unable to open file: name = '~laroque/foofile.egg', errno = 2, error message = 'No such file or directory', flags = 13, o_flags = 602
    major: File accessibilty
    minor: Unable to open file
17:59:49 [ INFO] uest_receiver.cc(225): Message handled
17:59:49 [ INFO] uest_receiver.cc(123): Waiting for incoming message
libc++abi.dylib: terminating with uncaught exception of type H5::FileIException
[1]    96925 abort      ./bin/mantis_server amqp.broker=higgsino.physics.ucsb.edu
nsoblath commented 9 years ago

The file opening takes place in Monarch, at line 56 of M3Monarch.cc. It's done in a try-catch block that should, in principle, work. The type of exception caught is H5:Exception, which is the immediate parent of H5:FileIException. The latter is what was thrown, according to the error message above. That should be caught by the base-class catch block. I'll do some testing to se what fixes the problem.

nsoblath commented 9 years ago

Ok, so apparently I wasn't paying enough attention when I looked at this in May. Line 56 of M3Monarch.cc is for opening files for reading. It was at line 83 where the file was opened for writing, and that was not in a try-catch block. It is now, and the exception is properly caught.