Fabio Di Paola

Reaching the limit ?

20 Ottobre 2013 Sviluppo 0

After some years with my procedures in place up & running we decided to expand the capacity of the system expanding the max size of the LOB column for the documents in Db2 from 10Mb up to 64Mb.
Quite easy, isnt’it?
Just a couple of days and then started the troubles.
The symptom was an error message on the server console:
23/09/2013 13.05.16 HTTP Server: Agent ‘db2out_age’ error: Error: Unable to allocate memory, Connector ‘db2’, Method -Fetch-
The file, of course, was not exported to the filesystem

Then I’ve changed the notes.ini on the server adding the line EIUseOSMemory=1 (found here )
This should prevent Domino to use its own memory but the OS memory.
After restarting the domino server everything seems to be ok for 3/4 hours but then I’ve got the same trouble with a different error message :
25/09/2013 11.31.03 HTTP Server: Agent ‘db2out_age’ error: Error: Failed attempting to allocate 67108864 bytes to fetch data into from BINARY column

As by now I was not able to figure where the problem lies and how to fix it.
It seems that the procedure tries to extract the file from the DB2 column and , doing this, wants to allocate 64Mb of memory (the size of the field) for each run even if the file contained in the column is only 150Kb.
After some time it’s possible that the memory isn’t released properly and then the system is no more able to allocate it in a correct way

Below you can read some lines of the code running on domino 8.5.3:
I declare the connections for Db2 and file system
Dim c_immagine As New LCConnection (“db2”)
Dim c_file As New lcconnection(“file”)

then I connect to both
Call c_file.select(Nothing,1,fl_file)
c_immagine.Database = database(0)
c_immagine.Userid = user(0)
c_immagine.Password = password(0)
c_immagine.MapByName = True

then the sql statement to select the record:
int_immagine = “select * from ” & p_tabimmagini_full_l & ” where ID=” & Cdbl(id$)
Call c_immagine.Execute(int_immagine, fldLstimm)

and then fetch the result (this is probably the line generating the error) and writes it to disk
Call c_immagine.Fetch (fldLstimm)
nf$ = fldLstimm.Lookup(“nomefile”).text(0)
Call fl_file.MapName(fldLstimm,”NOMEFILE,DOCUMENTO”,”filename,contents”)
Call c_file.Insert(fl_file)