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

Change timeout for session start #23

Open
KrobotP opened this issue Feb 16, 2021 · 7 comments
Open

Change timeout for session start #23

KrobotP opened this issue Feb 16, 2021 · 7 comments

Comments

@KrobotP
Copy link

KrobotP commented Feb 16, 2021

Hello,

I am using StcPythonRest for remote STC control. When connecting to the STC, i.e. creating an instance of StcPythonRest class, I often ends with: RuntimeError: failed to create session: 500 Internal Server Error: server error: timed out waiting for session to start. I was not able to find any way how to increase this timeout, is it possible somehow?

@pozarkar
Copy link

I see that in the https://github.com/Spirent/py-stcrestclient/blob/master/stcrestclient/stchttp.py, there is a function to set timeout
def set_timeout(self, timeout): """Seconds to wait for a response. Any zero-value means no timeout.""" self._rest.set_timeout(timeout)

@jmkho-spirent
Copy link
Collaborator

@KrobotP : I don't see a way. That error is coming from the backend and it looks like the value is part of the code and can't be modified via an API call. The method @pozarkar is referring to changes the timeout of the rest client but doesn't affect the timeout in the backend waiting for the STC session to start.

@KrobotP
Copy link
Author

KrobotP commented Feb 17, 2021

Thank you for your replies.

Calling any method would not help me anyway as this is happening when creating and object (i.e. in init). That is kind of sad that timeout can't be changed. Do you have any idea why these timeouts might occur? Maybe some wrong cleanup of previous session?

@jmkho-spirent
Copy link
Collaborator

The current timeout is 60 seconds. So for the session to not start up within that time seems like either the server might be getting overloaded. Are you running concurrent STC sessions? If so, how many do you typically have running at the same time?

@KrobotP
Copy link
Author

KrobotP commented Feb 17, 2021

I am running only one session at the time. However, it seems to me today that real problem is not that session is not created but it somehow dies during loading of a configuration from xml. I am trying to investigate this in more detail and I will report back if I found something new.

@KrobotP
Copy link
Author

KrobotP commented Feb 19, 2021

Well, so I tracked the error to the stc.config('automationoptions', logLevel='error', logTo='stdout') call. However, skipping this call produces same error on the next command: stc.perform('loadfromxml', FileName=xml_config_file). Both eventually leads to the new_session() from where the exception is raised.

Having this, I am still unable to tell why a session is not created during the timeout. The only solution for me so far is try to call the method repeatedly, until a session is created.

@jmkho-spirent
Copy link
Collaborator

Can you see if there are logs on the server side in a location like C:\Users\jkho\Documents\Spirent\TestCenter 5.18\Logs for the user that STC is running under? It may provide a clue as to why the sessions are not starting. You can email the logs to me directly.

Thanks.

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