Maintenance hangs server
David Smerdel
4-3-18
Hello

Since updating a customer to 8.4, there are problems with one of the maintenances they are using.
There is a maintenance which reads some data from one (or more) files and creates some records in the database.
It worked flawlessly in 8.3, but now it hangs the server when it finishes its work.

Looking at hansa.log, it even gets as far as writing "Duration 0.37 seconds" in the log, the files get deleted (as per code)....afterwards, the server stops responding. It can be restarted normally (meaning, without resorting to kill -9).

If it can't find any files to process, nothing happens and the server doesn't hang.

Has there been some fundamental change in 8.4, or is this a bug?

The code goes something like this:

global
updating procedure GetSomeDataMn()
begin
record DataVc DAr;

OpenFile("datafile.txt");
while (TestEOF==false) begin

    RecordNew(DAr);
//some code for filling the record
    RecordStore(DAr,true);

if (NextImportLine(true)) then begin end;
end;
CloseFile;
Delete_file("datafile.txt");
   
return;
end;
Aldevinas Katkus
4-4-18
We did exactly the same in the maintenance as you. I have called the client and asked about the performance. The client says the maintenance status window now closes earlier than in 8.3 and he waits until shortcuts in the Navigation window reappear. No (significant) difference between 8.3 and 8.4, except that maintenance status window. This is on Windows.
David Smerdel
4-4-18
Which build are you using?

Platform doesn't seem to matter with the problem here....server hangs even if I run the maintenance in "automatic" mode through Timed Operations....on build 84201208 (2018-01-26)
Aldevinas Katkus
4-4-18
Created byDavid Smerdel13:35 4 Apr 2018
Which build are you using? Platform doesn't seem to matter with the problem here....server hangs even if I run the maintenance in "automatic" mode through Timed Operations....on build 84201208 (2018-01-26)
build 2018-12-09. Are you importing large xml files? In my case one invoice corresponds to one TAB separated file.
Aldevinas Katkus
4-4-18
Created byAldevinas Katkus13:37 4 Apr 2018
build 2018-12-09. Are you importing large xml files? In my case one invoice corresponds to one TAB separated file.
oh, I see, it's .txt files
David Smerdel
4-4-18
Doesn't work for me on 2017-12-09 either....even on UK demo data with only this customization....


And yes, it's a .txt file...only a couple of lines, usually....gets processed in under 1 second.
Jarek Jamroszczak
4-13-18
why using maintenance for Import ? Maintenances are not meant for importing data
David Smerdel
4-13-18
Created byJarek Jamroszczak12:56 13 Apr 2018
why using maintenance for Import ? Maintenances are not meant for importing data
Well, one reason is that until now, they accomplished that task without problems.

The other reason is that I can't get an Import to run automatically with timed operations...
Jarek Jamroszczak
4-13-18
maybe try

DoImport = true/false


    i = 1;
    while (qupdating.DoImport(RepSpec,true,i)) begin

    i = i + 1;
    end;
David Smerdel
4-18-18
I tried, and strangely enough, running it with qupdating now works through Timed operations, but if I try to run the same maintenance manually, it still hangs.

Since I only need to run this "automatically", that is enough to solve the problem for me, so - thanks for the hint!
David Smerdel
5-3-18
Unfortunately, I must correct myself.
The issue isn't solved by doing this.

If someone is logged in at the time the maintenance is run, the server hangs. In the log file, it looks like the user ran the maintenance himself (even when he 100% did not).

Can I assume that this is not intended behavior and report it as a bug?
Jarek Jamroszczak
5-4-18
Created byDavid Smerdel17:02 3 May 2018
Unfortunately, I must correct myself. The issue isn't solved by doing this. If someone is logged in at the time the maintenance is run, the server hangs. In the log file, it looks like the user ran the maintenance himself (even when he 100% did not). C
Hello

1. it is hard to answer not knowing full code
2. what happens when OK Invoices (non stop) is run in your dbb
3. there are many other ways to achive what you want


Regards

Jarek
Paul Timms
5-16-18
Try commenting out all the code between OpenFile and CloseFile to see if it's this which is causing the hang. If so, you could add the file to an area rather than using OpenFile, to see if that helps.
David Smerdel
5-23-18
Paul, you are a lifesaver!

It never occurred to me to go through areas, and it solves my immediate problem on a test server. Deploying at the customer over the weekend, so hopefully that goes well.


Jarek, here are the answers to your questions/comments:
1. Code that crashes a test system in client/server mode (this is an abridged version with error checking and most of the string processing removed for clarity):

global
updating

procedure addPriceMn()
begin
record PLVc PLr;
string 255 tstr;


    OpenFile("importdata.txt");
/* while (TestEOF==false) begin
        RecordNew(PLr);
        tstr = ImportField;
        PLr.ArtCode = tstr;
        tstr = ImportField;
        PLr.PLCode = tstr;
        tstr = ImportField;
        PLr.ExVatPrice = StringToVal(tstr,M4Val);
        RecordStore(PLr,true);
if (NextImportLine(true)) then begin end;
    end;
*/    CloseFile;
return;
end;

2. OK Invoices (non stop) works as expected if I run it manually. Invoices get OKed, server doesn't hang. Haven't tried to set it up to run automatically, since the problem apparently lies in the "CloseFile" area.

3. I am sure there are other ways, Paul kindly pointed out one of them.
However, I still think fixing this bug is better than many people rewriting code with workarounds?


Additional question: are there any limits to the size of areas? I have another customer due to update to 8.4 who uses similar functionality to receive item data from a customer, and those files are several MB in size...
David Smerdel
5-30-18
Unfortunately, it doesn't work quite as well on the customer's production server.

It doesn't freeze anymore, like it did with Open/CloseFile, but now users are getting disconnected from the server (sometimes with errors like "wn != g_wn (2)..." ).

Any other ideas? :)
Leave Comment
You can subscribe to notifications for this post by selecting the 'star' icon on the top right corner of the post.
Back to the list
Latest Posts
Hello, Thank you very much for the help. Best Regards, Daniel...
07:07 28 Apr 2024
Andis Blicāns, Grasko
Hi, We have client using 8.5 2021-09-26 (build 85400383). The fields "Max Web Users" and "Max Sessions" ar blank. Server is closing itself almost every day. Message in hansa....
15:52 26 Apr 2024