Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Threading problem ? 1

Status
Not open for further replies.

nicolas46

Programmer
Mar 4, 2010
33
FR
Hi, I have develloped a script in a new livelink module. The goal of this big project was to import document/folder/object...into Livelink. (Livelink Object Importer was not able to do what we want).
Most of the time this project works fine but sometime I have a problem that i don't understand : The exectution of the script is suddently suspended (no reason) and if a user connect himself to Livelink (using a webbrowser) my script restarts and he finish its work well.
My log system write this :
19/03/2012 21:48 DAO_LL._Initialize
19/03/2012 21:48 <DAO_LL_FOLDER.Create()> Creation '1332183665548'
20/03/2012 08:29 DAO_LL.DeleteAllCategories
20/03/2012 08:29 </DAO_LL_FOLDER.Create()>

At 21:48 My script was suspended on a folder creation.
At 8:29 the day after, someone connect to Livelink to see if the script has done his job. At this moment my script restart and finish to work.

I don't understand what can I do to solve this...this is a big problem because i have an external program which is waiting the end of my script to do some treatment...

any clues ?


 
Looks like you are running into transaction based problems.Mostly when livelink is running it creates 5 connections to the underlying database. When a user logs in based on an existing connection this thread will get a program context for the user in qn and continue on. However if there is a huge unuse of livelink for e.g Friday evg to monday morning all threads to the livelink database are idle and it kind of sleeps.If you now force the browser(re-start is not needed) you will get in and it will connec itself back on.

are you suing StartTranscation/EndTranscation in your code.If so read the scoop on it.


Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937
Certified OT Developer,Livelink ECM Champion 2008,Livelink ECM Champion 2010
 
Thanks
@appnair: yes I use some StartTranscation/EndTranscation in my code. I don't understand "read the scoop on it" :) what do you mean by "scoop".
@ggriffit : The program architecture was not under my control at this time i was only a trainee ^^.

There is 1 module with 8 ospaces and a lot of functionalities. There is 2 ways to start a importation: push a button on a webreport or use a .bat program.
I encounter the problem when I use the .bat program. This .bat program starts a java program which calls a simple Oscript request handler which starts the importation. And the end of the treament the request handler writes an error code in a text file. During the treatment the java program tries to read this text file until there is an error code on it. In my case the java program doesn't receive the error code because the Oscript program is idle. (If the action is start with the .bat I don't use r.prgCtx connection...I use admin connection..(you know...$DBWizAPI..etc..because I can't simply connect my .bat program to livelink).

Do you think that if i create a web service instead of this request handler and change my java code to call this web service, it will solve my problem ?

Or maybe i can change my java program to call some livelink handler in background (every 30 min for example, just to force Livelink to not idle threads…) I don’t know…
 
You might want to look at the builder help that is what I meant.
It is hard to explain certain things
Code:
This is what better oscripters do

dbConnect = prgCtx.fDbConnect
dapiCtx = prgCtx.DSession()

if ( ! dapiCtx.StartTrans() )
	ok = FALSE
	errMsg = "DB does not have connection to do this"
	else
//write capi stuff with its own error checking
end

if ( ! dapiCtx.EndTrans( ok ) )
		ok = FALSE
		errMsg += "could not end transcation"
end

the above mysterious code I can try to interpret for you not totally true but my understanding assume the livelink server is up with 5 threads and about 200 people working on it.
What you are doing with the dapictx.StartTrans()  is telling the oscript engine I don't know or care how many db connections you have but I am also trying to do something to the database.
So if it can allocate one more you get a new connection and its count is bumped up when you are done you say gracefully release me.This is probably not right but I do it this way because I see Ot code also doing this way.

Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937
Certified OT Developer,Livelink ECM Champion 2008,Livelink ECM Champion 2010
 
Thanks appnair.
This is exactly what i do in my code. My code works for more than a year's now..so i don't thinks there is a big problem in it.
In addition to this, we now notice that we have a lot of lock in the database during this spleeping thread problem. Lock on update Dtree and LLAttrBlobData and Kstate...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top