Skip to content

Multidevice support #24

Open
Open
@xtrojak

Description

@xtrojak

Multidevice support of Java devices is not working (as expected). Problem seems to be in starting JVM multiple times. Follows the request with data sent & error message:

import datetime
node = {
    1 : {
        'experiment_details' : {'sleep_time' : 20},
        'devices' : [{
            'device_type' : 'PBR',
            'device_class' : 'PSI_java',
            'device_id': 'PBR01',
            'host_address': '/dev/ttyUSB0',
            'setup' : {
                'initial_commands' : [],
                'lower_outlier_tol' : 2,
                'upper_outlier_tol' : 3,
                'max_outliers' : 6,
                'min_OD' : -100,
                'max_OD' : 100,
                'pump_id' : 1,
                'ft_channel': 5,
                'OD_channel': 1
            }
        },
        {
            'device_type': 'GAS',
            'device_class': 'PSI_java',
            'device_id': 'GAS01',
            'host_address': '/dev/ttyUSB1',
            'setup': {
                'initial_commands': []
            }
        },
        {
            'device_type': 'GMS',
            'device_class': 'PSI_java',
            'device_id': 'GMS01',
            'host_address': '/dev/ttyUSB2',
            'setup': {
                'initial_commands': []
            }
        }]
    }
}

response = equests.post('https://localhost:5000/initiate', str(node), verify=False, auth=('BioArInEO', 'sybila'))
print(response)
'{"1": {"PBR": 1, "GAS": 1, "GMS": 1}}\n'
127.0.0.1 - - [03/Mar/2020 10:20:45] "POST /initiate HTTP/1.1" 200 -                                                                                                                                                                          
Exception in thread 1-PSI_java-GMS-checker:                                                                                                                                                                                                   
Traceback (most recent call last):                                                                                                                                                                                                            
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner                                                                                                                                                                       
    self.run()                                                                                                                                                                                                                                
  File "/home/bioarineo/PBRcontrol/DataManager/executioner.py", line 48, in run
    device = interpreter.DeviceManager(*arguments)  # initiate the physical device and its interpreter
  File "/home/bioarineo/PBRcontrol/DataManager/interpreterGMS.py", line 7, in __init__
    super(DeviceManager, self).__init__(device_details, device_class, log)
  File "/home/bioarineo/PBRcontrol/DataManager/base_interpreter.py", line 17, in __init__
    self.device = device_class(*args)
  File "/home/bioarineo/PBRcontrol/HWdevices/PSI_java/GMS.py", line 6, in __init__
    super(GMS, self).__init__(ID, address, "HWdevices/PSI_java/lib/config/device_GMS.config")
  File "/home/bioarineo/PBRcontrol/HWdevices/PSI_java/Device.py", line 17, in __init__
    self.device = self.connect(device_config)
  File "/home/bioarineo/PBRcontrol/HWdevices/PSI_java/Device.py", line 22, in connect
    JVMController.startJVM()
  File "/usr/local/lib/python3.7/dist-packages/jpype/_core.py", line 164, in startJVM
    raise OSError('JVM cannot be restarted')
OSError: JVM cannot be restarted

/usr/local/lib/python3.7/dist-packages/jpype/_core.py:217: UserWarning:
-------------------------------------------------------------------------------
Deprecated: convertStrings was not specified when starting the JVM. The default
behavior in JPype will be False starting in JPype 0.8. The recommended setting
for new code is convertStrings=False.  The legacy value of True was assumed for
this session. If you are a user of an application that reported this warning,
please file a ticket with the developer.
-------------------------------------------------------------------------------

  """)
Mar 03, 2020 10:20:48 AM psi.bioreactor.core.config.Config open
INFO: Config file opened: HWdevices/PSI_java/lib/config/device_GAS.config propCount=2
Mar 03, 2020 10:20:49 AM psi.bioreactor.core.config.Config open
INFO: Config file does not exists: HWdevices/PSI_java/lib/config/device_GAS.session
Mar 03, 2020 10:20:49 AM psi.bioreactor.message.command.CommandDefs initialize
INFO: Loading command manifests from HWdevices/PSI_java/lib/commands/commands_GAS...
Mar 03, 2020 10:20:49 AM psi.bioreactor.core.plugin.PluginManager loadPlugins
INFO: Loading plugins...
Mar 03, 2020 10:20:49 AM psi.bioreactor.core.plugin.PluginManager addDefaultServiceLoaders
INFO: Adding built-in plugins loader
Mar 03, 2020 10:20:49 AM psi.bioreactor.core.plugin.PluginManager addDefaultServiceLoaders
INFO: Searching plugins in HWdevices/PSI_java/lib/jar
Mar 03, 2020 10:20:49 AM psi.bioreactor.core.plugin.PluginManager loadPlugins
INFO: Loading plugins...
Mar 03, 2020 10:20:49 AM psi.bioreactor.core.plugin.PluginManager addDefaultServiceLoaders
INFO: Adding built-in plugins loader
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x76072bf0, pid=2165, tid=2191Mar 03, 2020 10:20:49 AM psi.bioreactor.core.plugin.PluginManager addDefaultServiceLoaders                                                                                              
INFO: Searching plugins in HWdevices/PSI_java/lib/jar

#
# JRE version: OpenJDK Runtime Environment (11.0.6+10) (build 11.0.6+10-post-Debian-1deb10u1)
# Java VM: OpenJDK Server VM (11.0.6+10-post-Debian-1deb10u1, mixed mode, serial gc, linux-)
# Problematic frame:
# C  [_jpype.cpython-37m-arm-linux-gnueabihf.so+0x20bf0]  JPypeTracer::trace1(char const*)+0x200
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/bioarineo/PBRcontrol/hs_err_pid2165.log
#
# If you would like to submit a bug report, please visit:
#   https://bugs.debian.org/openjdk-11
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Aborted

After this it was not possible to reproduce error, because the devices are not reachable anymore (on EUCZ_00101)

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions