Highlighted

Timeout caused by loops

Community Beginner ,
Feb 22, 2018

Copy link to clipboard

Copied

Hello guys, its me again.


While trying to fix the startup problems, I encountered a completely new bug.
My script runs perfectly when started in ExtendScript Toolkit. I am using infinite loops for socket operations, which can be broken under certain conditions (e.g. wrong request params etc.)

I am receiving following error when my script is being started from FM:

errorFM.png

The line mentioned above always varies - I repeat: the script runs well when being started in ExtendScript Toolkit.

I guess that the troublemaker are my infinite loops, but unfortunately I need them just the way they are.

How can I tell FM to disable this timeout?

Thanks thanks thanks.

Selim

TOPICS
Scripting

Views

190

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Timeout caused by loops

Community Beginner ,
Feb 22, 2018

Copy link to clipboard

Copied

Hello guys, its me again.


While trying to fix the startup problems, I encountered a completely new bug.
My script runs perfectly when started in ExtendScript Toolkit. I am using infinite loops for socket operations, which can be broken under certain conditions (e.g. wrong request params etc.)

I am receiving following error when my script is being started from FM:

errorFM.png

The line mentioned above always varies - I repeat: the script runs well when being started in ExtendScript Toolkit.

I guess that the troublemaker are my infinite loops, but unfortunately I need them just the way they are.

How can I tell FM to disable this timeout?

Thanks thanks thanks.

Selim

TOPICS
Scripting

Views

191

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Feb 22, 2018 0
Enthusiast ,
Feb 22, 2018

Copy link to clipboard

Copied

Hi Selim,

Would you post the script please?

Ian

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 22, 2018 0
Community Beginner ,
Feb 22, 2018

Copy link to clipboard

Copied

...

outer:

while(BOUNDARY_END_FOUND == false){

if(SOCKET_DEAD == true){

Primary_Socket = new Socket();

if(Primary_Socket.listen(PORT) == true){

log("#Restarted. Server listening to Port: " + PORT);

}//if

Primary_Socket.encoding = "UTF-8";

//Primary_Socket.timeout = 15;

SOCKET_DEAD = false;

}//if

else if(SOCKET_DEAD == false){

Poll_Socket = Primary_Socket.poll();

inner:

while (Poll_Socket != null) { // <-------- AT THIS POINT THE SCRIPT FAILED IN THE SCREENSHOT

//Poll_Socket.timeout = 15;

log ("\nConnection from " + Primary_Socket.host);

log("Date: " + Date());

Poll_Socket.encoding = "UTF-8";

var counter = 1;

//strLine = Poll_Socket.readln();

var strLine = Poll_Socket.readln();

while(strLine.indexOf(BOUNDARY_END) == -1){ //while2

if(SOCKET_DEAD == true || Poll_Socket == null){

break inner;

}

...


The marked place in the code is the loop waiting for an incoming connection in order to poll the socket.

But as I mentioned before, the script fails always on different points of the code when run directly by FM.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 22, 2018 0
Advocate ,
Feb 22, 2018

Copy link to clipboard

Copied

Concerning timeout - you may also get this under special conditions:

  • My script FMdict.jsx consists of these functions:
    • Introduction​: SwitchUILanguage (); ShowDictInfo (); SetUpMenus();
    • Functions Command(), GetIniValue(), SetUpMenus(), ShowDictInfo(), SwitchUILanguage ()
  • Note that an inner function (ShowDictInfo) is called before the script has set up a menu. This is to give the user a note just at the start FrameMaker, even before the appearance of the Welcome screen.

If the user does not react in due time to the Alert message of this function (click OK to dismiss the message) then I get the Timeout message when clicking the OK button:

Error in C:\Users\Klaus\AppData\Roaming\Adobe\FrameMaker\14\startup\FMdict.jsx
Line 63: alert (localize (text, currentPrj, currentDir), localize (title), false);
Timeout

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 22, 2018 0
Enthusiast ,
Feb 22, 2018

Copy link to clipboard

Copied

Yes I have seen this too. It is possible to select Delay load clients in Preferences > Global > Launch. This can be used to ensure that the script does not run until FrameMaker has finished its start-up procedures.

Ian

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 22, 2018 0
Community Beginner ,
Feb 26, 2018

Copy link to clipboard

Copied

Hello Ian,

I have tested your suggestion, but the problem is not solved. I still get a Timeout Error when I run my while loops. Is there any possible way to turn off this FrameMaker Timeout?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 26, 2018 0