System call to Atlantis word processor hanging

General development discussion.

Moderators: Susan Smith, admin, Gabriel

Susan Smith
Posts: 717
Joined: Sun Aug 10, 2008 4:24 am
Location: Southern California

System call to Atlantis word processor hanging

Post by Susan Smith »

Hi all,

I am having trouble with a system call hanging.

I print RTF documents from within my BR programs by doing a shell/system call to Atlantis word processor. You can call Atlantis from a commandline in BR and have the document print invisibly with no user interface displayed. This is more secure, which works best when you are printing sensitive documents such as contracts and checks. The client is running BR 4.2 (not Client Server) on a Windows Server 2008 network using Windows 7 workstations. They will phase this hardware out when they switch from my BR software to a different package at the end of this year, but I have to work with it until then as they do not want to spend any more money on upgrades that they will abandon.

Lately, Atlantis has been hanging. I have NO problems on a single user computer at all. And when the shell call is hanging, if I interrupt the program and GO 44670 - the line of the shell call - it works fine the second time. If the user logs out of BR and back in, the problem remains solved. If they log out of their Windows account and back in, the problem starts over. I can't imagine where to do with this. There is no error, so I can't trap for one and send the program back to the line programmatically.

The program line that hangs is:
44670 IF EXISTS(OUTPUTPATH2$) THEN EXECUTE "sys -w c:\"&PROGFOLDER$&"\atlantis\atlantis.exe /pt "&OUTPUTPATH2$&" "&'"'&TRIM$(CHECKSPRTR$)&'"'

which translates to this shell call:
sys -w c:\Program Files\atlantis\atlantis.exe /pt C:\BRLOCAL\NOTE-C011.rtf "SR Loan Corp Checks 1"

Where "SR Loan Corp Checks 1" is the network printer. The same hanging problem occurs if I use a different printer, network OR local.
Atlantis and the RTF file are located on the workstation, though the system call is in a program running in BR on the network.

The user has no such problem printing to this printer with other software (though that's probably not related).
If I load Atlantis manually (i.e. NOT from a commandline in a shell call), it will print this document just fine. It all seems to be related to the system call. I have upgraded Atlantis to a current version and nothing changed...same problem.

Does anyone have an idea of where I can on this? I have verified that Atlantis works fine when it's not called from a shell call, so I don't think it's Atlantis. (And the same programs work fine on my single user (no network) computer. We haven't changed anything recently, other than Windows updates. The problem used to be sporadic, but now it's quite persistent,

Thanks!

-- Susan
bluesfannoz
Posts: 291
Joined: Fri Jun 19, 2009 9:01 am
Location: Lawrence, Kansas
Contact:

Re: System call to Atlantis word processor hanging

Post by bluesfannoz »

The first thing I would check would be exclusions in any anti-virus program running for both BR and Atlantis. The simple check that the anti-virus does can cause timing to be off on all processes.

Also make sure the drive share they are running off is trusted in internet options.

That's my two quick possibilities. If that doesn't resolve it. I will have to think deeper.
Steve Koger
Computer Specialist
SEKESC-MACS Division
Susan Smith
Posts: 717
Joined: Sun Aug 10, 2008 4:24 am
Location: Southern California

Re: System call to Atlantis word processor hanging

Post by Susan Smith »

Thanks Steve. I will pass this along to their network admin!

-- Susan
Susan Smith
Posts: 717
Joined: Sun Aug 10, 2008 4:24 am
Location: Southern California

Re: System call to Atlantis word processor hanging

Post by Susan Smith »

FOLLOW-UP to my hanging system call to Atlantis:

We disabled security (Sophos) COMPLETELY on the workstation and disabled Windows Firewall as well. Turned off security completely on the file server where BR runs too. We still had the problem. The only thing that might be a clue is that this problem started occurring on a Monday and it's possible that there were Windows updates pushed over the prior weekend. The network guy is looking into that and I said that I would come back here to see if anyone had any other ideas. I have upgraded their copy of Atlantis (see my first message for the details of the problem) and it made no difference. This system call to Atlantis (to print an RTF file invisibly with no user interface) works beautifully from my single user computers (Win 7 AND Win10). But it chokes on their network for some reason. At their site, Atlantis is running on the Win7 workstations and BR 4.2 (not Client Server) is running on Windows Server 2008. I'm stumped.

-- Susan
GomezL
Posts: 258
Joined: Wed Apr 29, 2009 5:51 am
Contact:

Re: System call to Atlantis word processor hanging

Post by GomezL »

When I have a problem shelling to a program, I usually start by testing it at a command line.

I make a small "Test.cmd" script (I call it something like t.cmd)

The script will contain the actual command that you want to run

In your case:
c:\Program Files\atlantis\atlantis.exe /pt C:\BRLOCAL\NOTE-C011.rtf "SR Loan Corp Checks 1"

Step 1:
* From a command prompt, you can run the script, and see if it works
* If it works, then it's not the system/windows, and you can move to Step2
* If it fails, then you have a simple example you can provide to it and they can help to debug it.

Step2:
* From BR call the test script, and redirect output to a text file.
* SYS t.cmd >T.txt
* You can read T.txt to see what happened when you called the script.
* Again, you troubleshoot based on the results.
Susan Smith
Posts: 717
Joined: Sun Aug 10, 2008 4:24 am
Location: Southern California

Re: System call to Atlantis word processor hanging

Post by Susan Smith »

Thank you Luis! I will be working on this first thing on Tuesday, so I will follow your directions. I appreciate you taking the time to be so specific with the step-by-step. I have tried so many things by now that my head is spinning. This is a good way to get back to basics. The weirdest thing about this situation is that it only happens when the user has a fresh Windows login. If I Ctrl/A (because it's hanging) and "GO XXXX" and repeat the line with the system call, it works! And then it will continue to work every time until the user logs out of Windows and come back in.

I hope that your idea provides some new clues. Thanks again!

-- Susan

(Hope to see you one of these days - maybe a BR conference next spring? Crossing my fingers.)
Gabriel
Posts: 412
Joined: Sun Aug 10, 2008 7:37 am
Location: Arlington, TX
Contact:

Re: System call to Atlantis word processor hanging

Post by Gabriel »

If its only the first time the user logs on, that gives me a couple other questions: Is this running off an external hard drive? or an internal one?

I had an issue before where the first time I try to run a program, it spins up the external hard drive, and that takes a second. That was causing the program I wanted to launch to fail the first time. If I tried it again a second later, it worked just fine, because the drive was already spinning and there was no delay.

In that case, i copied the program I was using onto an internal drive and that solved the problem for me.

I don't know if that'll help but i wanted to at least ask.

Gabriel
Susan Smith
Posts: 717
Joined: Sun Aug 10, 2008 4:24 am
Location: Southern California

Re: System call to Atlantis word processor hanging

Post by Susan Smith »

Hi Gabe,

No external drive. They are running off of a Windows 2008 server with internal hard drives. All workstations are Win7. BR (4.2, not C/S) is running from a drive share (D:) on the server and Atlantis is installed locally on each workstation. The file that is bring printed is created on the workstation local hard drive (C:\BRTEMP). So the system call is supposed to load Atlantis from the workstation invisibly, and print the file listed in the system call to the printer specified in the system call. This has worked for 10 years with no problems.

sys -w c:\Program Files\atlantis\atlantis.exe /pt C:\BRLOCAL\NOTE-C011.rtf "SR Loan Corp Checks 1"

Then on April 1st, it started failing.

When a user freshly logs into their Windows account, the system call hangs. I have to interrupt it with a Ctrl/A manually). Then if I redirect the BR program to the SAME line to repeat the system call, it works fine the second time. After that, it will continue to work until the user logs out of Windows. If the system call generated an error instead of hanging, it would make more sense and I could possibly trap the error and programmatically deal with it.

1. Steve had posted a couple of ideas (see his reply in this thread) and we tried those. No difference.
2. I have tried removing the /pt switch in the system call which causes Atlantis to run silently. I have also removed the -w. No difference.
3. I have put the system call in a batch file and run it from there instead of embedding it in the BR program. No difference.
4. I have redirected to a local printer on the workstation. No difference.
5. The network guy uninstalled Windows updates that were pushed out about that time. No difference.
6. He disabled all security on the server and on the workstation, going so far as to uninstall the Sophos (their security product). No diff.

NEXT IDEAS:
1. I will try Luis's test on Tuesday to see if I gain any more information although I don't know if redirecting the system call to a text file will give me anything if it's hanging. But you never know and I hope it DOES say something.
2. Replace Atlantis. I have already tried upgrading Atlantis to their current version with no apparent difference. Word can accomplish this, but you have to write a VB or C# program and I'm not equipped to do that (no Visual Studio, no VB compiler and no experience with C#). Open Office might be a possibility, but it frequently changes the format from what Atlantis/Word use and these contracts have to be exactly the same as what they have now). I have found a few utilities that may be able to render and print an RTF file from a system call, but I haven't purchased any of them to test yet and most that I have found do not have a free trial. So I will continue to chase down that angle (a substitute program for Atlantis) as a backup plan.

The infuriating thing is that this all works fine on my single Win7 and single Win10 computers. Of course. I have different security options than they do. I may try setting up their BR system on one of the workstations to see if it works when BR is located locally (all other security being the same). Then the network guy wants me to try to run Atlantis locally on the server. (I will have to install it their first. It's not a multi-user product, so that's why it's running on the workstations.)

Thanks for listening/reading and chiming in. You never know when someone's comment might lead to a clue. I thought that something you said Gabe could be a clue. You indicated a timing issue. (This indirectly relates to Steve's idea as well.) We used to have a problem with this same system call because the RTF that it creates wasn't available yet on the server when I tried to print it. It's one of those replacement RTF files (remember David Blankenship's tutorials at the conferences?) where you have a master RTF document with substitution parameters in it. I have created multiple documents - contracts, checks, and others where I have to replace the place holders in the RTF file with real information (name, address, dollar amounts, etc), save it as a separate RTF file and then generate the system call to print it. But in the past, I would close that new RTF file that I had printed, and it would error (file not found) when I went to print it. I had to put a SLEEP(2) into the program before executing the system call because the server didn't quite know about the availability of the file yet. If i re-executed the system call, it worked the second time. But once you have it enough time with the SLEEP command, it ran fine. It COULD be some sort of a timing issue here, except that the fact that it continues to work every time until a Windows logout/login, doesn't seem to fit that scenario as well. I should note that I use this same method (RTF file modification) in several different programs for different documents. It fails on all of them the same way.

Anyway...this is about all I know at the moment.

-- Susan
Gabriel
Posts: 412
Joined: Sun Aug 10, 2008 7:37 am
Location: Arlington, TX
Contact:

Re: System call to Atlantis word processor hanging

Post by Gabriel »

This might not be pretty, but it may work:

Is there a way you could trap for the error, and when you encounter it, sleep for a minute, and then try again?

In BR when I call external programs, I often do it with the -C switch so that BR continues running .., then I loop and check for the appearance of an output file. This enables me to display a "Please Wait" animation, and to recover gracefully if the external application failed.

It would be a lot better to get Atlantis working, of course, but I wanted to offer this suggestion, in case there's a way to get around the problem. Your program could launch the Atlantis batch file, and then loop while waiting for output. Make sure to put a "sleep (.2)" in there so that BR pauses between checking for the file and doesn't hog the CPU while Atlantis is trying to run.

The output file could be something as simple as a line like "echo done>done.txt" at the end of your script, if nothing else. When the file is created, you exit your loop and continue with your program. If a certain amount of time goes by and the file isn't created, then you try launching Atlantis again (or display a message box and try again, depending on the situation). In this case, i'd probably have it try silently a couple of times before alerting them that anything is hanging.


The other thing that I notice that you might try changing is: in an effort to fight scammers and viruses, Microsoft has been really cracking down on which files and folders people have access to. Their general idea is that programs should do all their temp work in the "AppData" folder. Since it seems to be some timing issue, i know the users have access to that folder .. but I wonder if Windows isn't doing something to double check that its not a virus before running your command. If it worked for years and all the sudden started messing up, it could very well be that Microsoft released some update on April 1st that changed how things work.

Try creating the file in their AppData folder (the path is "%appdata%") and launching it from there. If that doesn't work, maybe the solution above will help.

Gabriel
Susan Smith
Posts: 717
Joined: Sun Aug 10, 2008 4:24 am
Location: Southern California

Re: System call to Atlantis word processor hanging

Post by Susan Smith »

I can definitely move the temp stuff to the appdata folder. That would be easy and I could do that quickly. I don't know about trapping the error on the system call because it's not erroring at all. It's just hanging. Otherwise, I would have done what you suggested. I still might play around with some of those ideas though - like outputting to a dummy file to see if anything ends up there. Sometimes it helps flush out other information about the problem. Thank you very much for brainstorming this with me.

-- Susan
Gabriel
Posts: 412
Joined: Sun Aug 10, 2008 7:37 am
Location: Arlington, TX
Contact:

Re: System call to Atlantis word processor hanging

Post by Gabriel »

Of course! I'm happy to brainstorm with you!

I know the process is just hanging and not returning any error. Thats why I described how to do it a different way, so that even if the process hangs, your program still retains control and can launch a second process that will hopefully succeed (since you said it seems to work the second time).

But anyway, if the AppData folder doesn't solve it for you first, then we can look at this again. But hopefully that will fix it for you.

Gabriel
Susan Smith
Posts: 717
Joined: Sun Aug 10, 2008 4:24 am
Location: Southern California

Re: System call to Atlantis word processor hanging

Post by Susan Smith »

Oh, now I see what you're saying. (Slow learner here. LOL) If it launched a second process, would that leave the first process hanging? We did have an issue where a couple of times, Atlantis started taking up 100% of the CPU. I bet it was that hanging Atlantis process. I'm pretty sure you will say no, but Is there a way in BR to programmatically kill a process? But if there were a way and none of the other solutions worked, I could conceivably do what you said to launch the second process, complete it and if the first one is still running, kill it. I just don't know if BR can access that kind of OS information in the task manager to force a process to stop. But I hope that it doesn't get to that point anyway.

Thanks again, Gabriel. And Luis, Steve, and Mike Miller (who emailed me). It feels like you're all here with me! If this weren't such a frustrating problem that's been going on for 3 months now, this troubleshooting would actually be fun! I'll report back next week to let you know what happened.

-- Susan
Gabriel
Posts: 412
Joined: Sun Aug 10, 2008 7:37 am
Location: Arlington, TX
Contact:

Re: System call to Atlantis word processor hanging

Post by Gabriel »

Well, it would be pretty ugly. But we could probably figure out how to kill the task using the windows command line program "taskkill". We'd have to list the processes to a file, then parse the file to get the process ID, then give the command again specifying which task to kill. Yes, it would be a problem that the process would still be hanging out there taking up their resources. But if we have to we can find a way to kill it from the BR program.

Hopefully the AppData folder solves this for you. It would be a lot better to solve the problem, then try to work around it.

Gabriel
John
Posts: 555
Joined: Sun Apr 26, 2009 8:27 am

Re: System call to Atlantis word processor hanging

Post by John »

I used to use %appdata%, but now prefer to use %programdata%. I don't recall why I made the switch. It's a shorter path with no spaces which can be helpful sometimes. i.e. c:\programData vs C:\Users\niceg\AppData\Roaming.

Susan, you might try calling Atlantis waiting 2 seconds and calling it a second time... and just do that the first time (set an env variable to check or something). If it did work the first time, it may not open a second session but instead, just put the focus to the already open one. Or it may not be helpful at all, just trying to help grasp at straws here.



-john
John Bowman
dmeenen
Posts: 50
Joined: Mon Jun 08, 2009 8:34 pm
Contact:

Re: System call to Atlantis word processor hanging

Post by dmeenen »

Susan,
Here is how Steve and I Kill a running process before starting another process for the same program. (7za.exe in this case)

execute "sy -M start /wait /b taskkill.exe /im 7za.exe /f" ! Kill 7za in Windows
substitute your Atlantis.exe for 7za

Also, Network Shared drives are giving us fits as well. Gabe is correct that Microsoft is restricting operations from shared network drives.
We are converting all of our clients to Client/Server because of this.
Users are seeing a significant increase in performance after Client/Server is installed and working.

My 2 cents.
Doug
Post Reply