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

The script fails to run repeatedly. #3

Closed
vis-ikeda opened this issue Oct 1, 2020 · 6 comments
Closed

The script fails to run repeatedly. #3

vis-ikeda opened this issue Oct 1, 2020 · 6 comments
Assignees

Comments

@vis-ikeda
Copy link
Contributor

何度か試しているとscripts側が死ぬことがあり要調査

Traceback (most recent call last):
File "/kagra/apps/pcaspy/lib/python2.7/site-packages/pcaspy/driver.py", line 450, in getValue
newValue = driver.read(self.info.reason)
File "steppingmotor/pcasip.py", line 210, in read
value = self.driver.getLeftLimitSwitch(motorAddrC)
File "steppingmotor/Trinamic_control6110.py", line 528, in getLeftLimitSwitch
data = self.receiveData()
File "steppingmotor/Trinamic_control6110.py", line 94, in receiveData
RxBuffer = self.port.recv(9)
socket.timeout: timed out
Traceback (most recent call last):
File "/kagra/apps/pcaspy/lib/python2.7/site-packages/pcaspy/cas.py", line 416, in read
def read(self, *args): return _cas.PV_read(self, *args)
RuntimeError: SWIG director method error. Exception Calling Python Code
filename="../../../../src/cas/generic/st/casStreamOS.cc" line number=479
Internal failure - unexpected problem with client's input - forcing disconnect
/kagra/apps/pcaspy/lib/python2.7/site-packages/pcaspy/cas.py:235: RuntimeWarning: tp_compare didn't return -1 or -2 for exception
if primitiveType in [aitEnumUint8, aitEnumInt8]:

@vis-ikeda vis-ikeda self-assigned this Oct 1, 2020
@vis-ikeda
Copy link
Contributor Author

    if (name == "UPDATE") and (value == 1.0):
        self.driver.reconnect()

reconnect()を削除したら発生しなくなった。
reconnect()を呼ばなくても正常に動作する。
接続状態なのに呼ぶタイミングはおかしい。
なぜ入っているか不明!?
とりあえず削除して進めて異常が発生したら別の手段で修正予定。

@terrencetec
Copy link

Can we simply use something like:

while 1:
    try:
        ...
        break
    except RuntimeError as e:
        logger.error(str(e))
        pass

to bypass the error?

@vis-ikeda
Copy link
Contributor Author

Thanks for the advice.

This case is an idea that needs to be addressed more fundamentally than error avoidance with try-except.
I think error avoidance should be put in for irregular errors first, after it works correctly.
Maybe calling reconnect() is the wrong thing to do.
If reconnect() is necessary, we think it needs to be called conditionally.

@vis-ikeda
Copy link
Contributor Author

vis-ikeda commented Oct 9, 2020

直前のコマンド送出後に結果を受信するが
k1scriptの処理負荷による遅延によって処理が回ってこない場合に
タイムアウトが発生しているように見える。
モータードライバ側もエラーは発生していない。
試しにタイムアウト時間を2秒から30秒に変更して1日そのまま放置してみたが
問題が発生しなくなったので多分処理時間の問題と推測される。
とりあえずこれで様子を見てまた考える。

class Trinamic_control6110():
...
def init(self):
# Changing the timeout due to slow process.
# self.timeout = 2.
self.timeout = 30.

reconnect()は多分これで入れていたのではないかと思うが、
呼ぶ必要はないのでこのまま消した状態とする。

@MiyoKouseki
Copy link
Member

Complete the issue?
Could you move this issue to the Review/QA ?

@MiyoKouseki
Copy link
Member

After his bug fix, this bugs have not happen according to his test.

Close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants