Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JVM cannot be restarted #6

Closed
xtrojak opened this issue Oct 24, 2019 · 7 comments
Closed

JVM cannot be restarted #6

xtrojak opened this issue Oct 24, 2019 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@xtrojak
Copy link
Collaborator

xtrojak commented Oct 24, 2019

Restarting a node (eg. end and start again) resulted to the following error:

192.168.17.1 - - [24/Oct/2019 18:02:19] "POST /initiate HTTP/1.1" 200 -

Exception in thread 1PBR-checker:
Traceback (most recent call last):
  File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "/home/pi/PBRcontrol/DataManager/executioner.py", line 48, in run
    device = interpreter.DeviceManager(*arguments)  # initiate the physical device and its interpreter
  File "/home/pi/PBRcontrol/DataManager/interpreterPBR.py", line 49, in __init__
    super(DeviceManager, self).__init__(device_details, device_class, log)
  File "/home/pi/PBRcontrol/DataManager/base_interpreter.py", line 9, in __init__
    self.device = device_class(self.device_details['device_type'], self.device_details['address'])
  File "/home/pi/PBRcontrol/HWdevices/PSI_java/PBR.py", line 7, in __init__
    super(PBR, self).__init__(ID, address, "/home/pi/PBRcontrol/HWdevices/PSI_java/lib/config/device_PBR.config")
  File "/home/pi/PBRcontrol/HWdevices/PSI_java/Device.py", line 16, in __init__
    self.device = self.connect(device_config)
  File "/home/pi/PBRcontrol/HWdevices/PSI_java/Device.py", line 20, in connect
    "-Djava.class.path=/home/pi/PBRcontrol/HWdevices/PSI_java/lib/jar/bioreactor-commander-0.8.7.jar")
  File "/home/pi/.local/lib/python3.5/site-packages/jpype/_core.py", line 157, in startJVM
    raise OSError('JVM cannot be restarted')
OSError: JVM cannot be restarted
@xtrojak xtrojak added the bug Something isn't working label Oct 24, 2019
DanDayne added a commit that referenced this issue Oct 25, 2019
@DanDayne
Copy link
Collaborator

Problem is in the implementation of PSI_java - if multiple nodes try to start JVM on the same system, PBRcontrol will fail as it is not possible. Only one JVM can be running at a time.

@DanDayne
Copy link
Collaborator

DanDayne commented Oct 25, 2019

This introduces many problems regarding use of multiple java-bound PBRs and restarting PBRs

@mgeletka
Copy link
Collaborator

created PULL request #15

@DanDayne
Copy link
Collaborator

DanDayne commented Nov 7, 2019

Once JVM is started, it is never turned off as there is currently no way of knowing whether other devices/nodes are using it. This should not afffect functionality, nor performance. My temporarily limited resources prevent me from thorough testing. @xtrojak, could you look into this?

@DanDayne
Copy link
Collaborator

Initiation of Java device resulted in following error:

/home/pi/.local/lib/python3.5/site-packages/jpype/_core.py:210: 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.
-------------------------------------------------------------------------------
  """)
Exception in thread 19PBRPBR19-checker:
Traceback (most recent call last):
  File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "/home/pi/PBRcontrol/DataManager/executioner.py", line 52, in run
    device = interpreter.DeviceManager(*arguments)  # initiate the physical device and its interpreter
  File "/home/pi/PBRcontrol/DataManager/interpreterPBR.py", line 48, in __init__
    super(DeviceManager, self).__init__(device_details, device_class, log)
  File "/home/pi/PBRcontrol/DataManager/base_interpreter.py", line 17, in __init__
    self.device = device_class(*args)
  File "/home/pi/PBRcontrol/HWdevices/PSI_java/PBR.py", line 7, in __init__
    super(PBR, self).__init__(ID, address, "/home/pi/PBRcontrol/HWdevices/PSI_java/lib/config/device_PBR.config")
  File "/home/pi/PBRcontrol/HWdevices/PSI_java/Device.py", line 16, in __init__
    self.device = self.connect(device_config)
  File "/home/pi/PBRcontrol/HWdevices/PSI_java/Device.py", line 19, in connect
    CommanderConnector = jpype.JClass("psi.bioreactor.commander.CommanderConnector")
  File "/home/pi/.local/lib/python3.5/site-packages/jpype/_jclass.py", line 130, in __new__
    return _JClassNew(args[0], **kwargs)
  File "/home/pi/.local/lib/python3.5/site-packages/jpype/_jclass.py", line 213, in _JClassNew
    javaClass = _jpype.PyJPClass(arg)
jpype._jclass.java.lang.NoClassDefFoundError: psi/bioreactor/commander/CommanderConnector

@mgeletka, do you have any idea what might be causing this issue?

@xtrojak
Copy link
Collaborator Author

xtrojak commented Nov 27, 2019

Seems like problem in paths management.

xtrojak added a commit that referenced this issue Feb 21, 2020
xtrojak added a commit that referenced this issue Feb 21, 2020
@xtrojak
Copy link
Collaborator Author

xtrojak commented Feb 21, 2020

Issue solved by manual addition of Java class path before the JVM is started (in Device.py file). It is not clear why this step is necessary, but it is working.

@xtrojak xtrojak closed this as completed Feb 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants