A lock is not available for sas

I'm working with a complex set of SAS anycodings_sas algorithms, created by a group outside of my anycodings_sas company, to prepare a report required each anycodings_sas year. Unfortunately, I am running into a anycodings_sas file lock problem:

ERROR: A lock is not available for anycodings_sas WORK._TEMP_OP_OTHER.DATA

I did have a similar issue last year, but it anycodings_sas then appeared to be a somewhat random anycodings_sas problem that cropped up (rarely) during anycodings_sas execution. I reviewed the logs to see if the anycodings_sas problem occurred, and if so cleaned up the anycodings_sas output files and ran the algorithm again.

This year's report is consistently producing anycodings_sas the error in the same place every time I run anycodings_sas the algorithm. I have tried a couple of anycodings_sas things to give the system more time in the anycodings_sas hopes that the lock will become available: anycodings_sas inserting a SLEEP command and also setting anycodings_sas FILELOCKWAIT=n in libname statements. anycodings_sas Neither has worked as I'd hoped.

FILELOCKWAIT seems like the most promising anycodings_sas option, but when observing the execution of anycodings_sas the algorithm and reviewing the logs it's anycodings_sas clear that the process is failing anycodings_sas immediately at that section, consistent with anycodings_sas the default FILELOCKWAIT value of 0 seconds.

I am far from an expert in SAS, but I am anycodings_sas wondering if I need to set FILELOCKWAIT for anycodings_sas WORK, as that is where the lock issue is anycodings_sas coming up. Is there a way to do this, and anycodings_sas might it help my problem? If not, are there anycodings_sas other options I could look into?

(Note: I am aware of the TRYLOCK macro, but anycodings_sas want to introduce as few changes as possible anycodings_sas to the algorithms I'm running. As mentioned anycodings_sas above, they are complex and I am concerned anycodings_sas about introducing unintended problems which anycodings_sas may be difficult to notice, diagnose, and anycodings_sas fix).

I created a SAS session on Jupyter notebook using SASPY and ran a process. It took a long time and got stuck, hence I restarted the Kernel. When I created a new session and wanted to access the source table, I received an error message that another process has the lock.

ERROR: A lock is not available for X.DATA. ERROR: Lock held by process 23243.

How may I unlock the table above by accessing the other session or process and stop/close it?

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. Linux]
  • SAS Version: [e.g. 9.4M3]
  • SASPy Version: [e.g. 2.2.7]

Additional context
Add any other context about the problem here.

Sorry to hear that. Where is SAS running? on your same machine as python? A remote machine? Windows or Linux? Normally, restarting the kernel in jupyter (which terminated the python process) will cause saspy to terminate the SAS session it's connected to. It sounds like something didn't happen in this circumstance. You have the process id, are you able to access that system and kill that process yourself? If not, depending on what OS it is, we may be able to do it remotly.
Tom

Also worth mentioning. Jupyter has an 'interrupt kernel' feature, which is basically a keyboard interrupt (CTL-C). If you are in a situation where a saspy method is executing, using that should allow you to interrupt saspy such that you can either stop the current method, or, at least subsequently restart the kernel with saspy going through the normal shutdown process.
Tom

Any updates on this?
Thanks,
Tom

Tom, here is my responses:

Where is SAS running? on local machine but running the code to the SAS remote. a winlocal SAS session with singon to the remote SAS.

import saspy
import getpass
sas = saspy.SASsession(cfgname='winlocal')
MDC_pass = getpass.getpass(prompt='Password for MDC: ', stream=None) 

next cell:

%%SAS sas
%let test=xxxxxxxx 7551;                                                                                                                                                         
options comamid=TCP remote=test;                                                                                                                                                               
signon username=xxxxxxxpassword=MDC_pass ; 

on your same machine as python? Python is on my personal machine. SAS session is on my local but it send the codes to the remote SAS.
A remote machine? Yes
Windows or Linux? Local is windows, remote is Linux
You have the process id, are you able to access that system and kill that process yourself? I am not sure how to use ID to kill the session and unlock the data table.

Thanks Tom again

Oh, ok. So it's a table on the remote linux system that's locked. And, are you sure it's locked because of the session you had? It's been decades since I used SAS/Connect, but I would think if the connection was broken it would shutdown on the remote side, and tables wouldn't remain locked. But I don't have enough info to know what has or hasn't happened.

Can you log on to that linux system to see what that process is? To see if it was your Connect server side process, as opposed to someone else, who's connected and accessing that file? Can you submit X commands on the remote system? If that's allowed, then you can at least explore the system remotely that way, if you can't ssh to the machine directly.

If none of this make sense, or you can't do any of it, is there an administrator for that system who could do these things and verify that process it says has it locked was your connect session that is still running and terminate it for you? Can you reconnect to that session (I don't know if that's a possibility or not)?

Thanks,
Tom

The other though is if your client side SAS process didn't actually shut down somehow. It's conceivable that, even though the python process went away when you restarted the kernel, and the java process saspy uses to talk IOM to the local SAS went away, that if that SASsession was in the middle of some SAS/Connect work, it might still be running on your machine; orphaned, but still keeping the server side connected.
Again, I don't have enough to know if this could be the case. But you can look at the processes on your machine to see if this happens to be it or not. That's easy enough.

Thanks. I terminated the session by connecting to the SAS server directly.

Ok, good deal. This is an interesting case, using SAS/Connect. I do find it interesting to see all the different ways people are using this. Hopefully, if you interrupt the kernel, instead of terminating it, this might be able to shut down cleanly. I'd have to actually try using connect in this case to see what might be happening though. So I can't say for sure.
Would you like to dig into this deeper, or are you ok for now, seeing as you solved this issue?
Thanks!
Tom

Tom-- It is solved on my end.

-- Rooholah Hadadi Phone: 786.361.5888 E-mail:

On Jan 8, 2019, at 11:08 AM, Tom Weber ***@***.***> wrote: Ok, good deal. This is an interesting case, using SAS/Connect. I do find it interesting to see all the different ways people are using this. Hopefully, if you interrupt the kernel, instead of terminating it, this might be able to shut down cleanly. I'd have to actually try using connect in this case to see what might be happening though. So I can't say for sure. Would you like to dig into this deeper, or are you ok for now, seeing as you solved this issue? Thanks! Tom — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

Cool, I'll close this. Just let me know if you need anything else!
Tom

What does a lock is not available mean in SAS?

ERROR: A lock is not available for dsname. DATA, lock held by another process. The problem can occur when software external to a SAS® session is accessing your SAS data sets. These collisions can result from any number of different software programs, such as backup software or virus protection software.

How do you release a lock on a SAS dataset?

To ensure that an exclusive lock is guaranteed across multiple SAS sessions, you must use SAS/SHARE. To release an exclusive lock, use the CLEAR option. In addition, an exclusive lock on a data set is released when you use the DATASETS procedure DELETE statement to delete the data set.

What is a lock in SAS?

The LOCK command enables you to specify the name of the data object to be locked on the command line of a window, such as the SAS Display Manager System's Program Editor window. You must first access a SAS data library through a SAS server before you can lock that library or any data object in it.

How do I unlock a table in SAS?

Re: Unlocking a locked a Locked dataset The only way to unlock the table is to kill the (SAS-) process locking the table - or to ask the user locking the table to close it.