BookmarkSubscribeRSS Feed

When EG freezes, there is no way of knowing which EG session to kill.

 

Variable SYSJOBID gives the SAS server proces number.

A way to know the local EG process number would allow us to save it somewhere (a text file saved in the work directory at connection time for example).

 

A startup option to have this process number added to the window title would be another way to deal with this ongoing problem.

 

 

19 Comments
Kurt_Bremser
Super User

Like the idea of an option that adds the process number to the window title. Window title is still shown even when EG is completely dead.

ChrisHemedinger
Community Manager

One of my favorite Windows tools is Process Explorer (formerly Sysinternals, but now a Microsoft tool).  You can drag a little window "wheel" to the "hung" window, and it will show you which PID is the culprit.  You can also filter by user ID, command line, and open file handles (look for the EGP file that's open).

 

egpid.gif

 

I once blogged about this for SAS admins trying to find the right SAS.EXEs to examine/kill.

ChrisNZ
Tourmaline | Level 20
I like processexplorer too Chris. Sadly we can seldom install anything on our computers. I must access these forums with IE and my text editor is notepad! Not long ago task manager was out of reach.....
RobP
Quartz | Level 8

Agreed - process explorer is the bomb.  @ChrisNZ I don't know if you have the ability to auto-run SAS code on EG startup, but this code will calculate the EG process ID for you and write it to a file in your work folder.  It's would be a satisfactory workaround until SAS-Christmas comes around...

 

filename sascbtbl "%sysfunc(pathname(work))\sascbtbl.txt" lrecl=500;

data _null_;
  file sascbtbl;
  infile datalines;
  input;
  put _infile_;
datalines4;
routine GetCurrentProcessId
   minarg=0
   maxarg=0
   stackpop=called
   callseq=byvalue
   module=kernel32;
;;;;
run;

%let current_sas_process_id = %sysfunc(modulen(*e,GetCurrentProcessId));
%put &current_sas_process_id;

data _null_;
  file "%sysfunc(pathname(work))\pid_&current_sas_process_id..txt";
  put "&current_sas_process_id";
run;

 

 

According to the documentation (http://support.sas.com/documentation/cdl/en/hostwin/63047/HTML/default/viewer.htm#p16v72tro1likwn10w...) you can only change the window title for a SAS session on startup.  Not sure if the same applies to EG or not, I couldn't find anything title-specific for EG when searching.

ChrisHemedinger
Community Manager

Hi @RobP - good tips, but these would work only for the SAS.exe process and not the SEGuide.exe process, which is what @ChrisNZ is after.  (I'm sure he's not the only one -- he's just the one who took time to ask.)

RobP
Quartz | Level 8

Ah I see... I tested the code in EG and when it returned a number I assumed it was the EG PID.  I should have double checked against Process Explorer before posting.... 

 

So I'm guessing EG launches calls to SAS in a new process every time code is executed, and EG doesn't actually ever execute any 'SAS' code.

ChrisHemedinger
Community Manager
Status changed to: Not Planned

With the Process Explorer workaround given, this is not planned by SAS R&D.  However, it's not difficult to create a custom task that implements this.  I just prototyped something quickly -- here's a screenshot of the result.  Let me know if you're interested in this approach.

 

pids.png

 

ChrisNZ
Tourmaline | Level 20

@ChrisHemedinger Your workaround is unavailable to most EG users as most company desktops are (rightfully) fully locked, and/or staff can be fired for running non-approved programs.

Can you tell us more about the custom task?

ChrisHemedinger
Community Manager

@ChrisNZ I shared an example on GitHub -- see if it helps to do what you're after.

ChrisNZ
Tourmaline | Level 20

@ChrisHemedinger This is no better for the same reason.

 

aaa1.PNG

 

Please change the status back from Not Planned

 

None of the suggested "workarounds" is usable by the target audience: SAS customers.