Skip to content

Commit

Permalink
remove keepalive in IOM; it can deadlock
Browse files Browse the repository at this point in the history
  • Loading branch information
tomweber-sas committed Apr 9, 2024
1 parent 1980eed commit bb12262
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 33 deletions.
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,29 @@



## [5.10.0] - 2024-04-09

### Added

- `None` Nothing added

### Changed

- `None` Nothing changed

### Fixed

- `None` Nothing fixed

### Removed

- `Enhancement` Per user request, I've added the ability to request a keepalive thread in the IOM access method.
I added this in V5.9.0, but then found that this could deadlock the IOM access method if the keepalive thread executed while in the middle
of one of my SASPy methods; which I didn't think would be the case, but I didn't happen to have it happen. When it
does, it can deadlock everything. So, I'm removing this feature with this release. It just doesn't work as expected.



## [5.9.0] - 2024-04-08

### Added
Expand Down
5 changes: 0 additions & 5 deletions saspy/doc/source/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -702,11 +702,6 @@ encoding -
windows-1252, respectively.
timeout -
Timeout value for establishing connection to workspace server
keepalive -
Specifies to create a thread that makes a call to the Workspace server every X number of minutes to keep the
server from timing out. The Workspace servers timeout value is defined in Metadata and if this is set to be less
minutes than the timeout, it will keep the server from timing out and terminating. The default timeout for Workspace
servers is usually 60 minutes, but it can be set to whatever by an admin who defines these in metadata.
appserver -
If you have more than one AppServer defined on OMR, and one object spawner is configured to start workspace servers
from multiple Appservers, then you may need to pass the name of the physical workspace server (as defined in metadata)
Expand Down
27 changes: 0 additions & 27 deletions saspy/sasioiom.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import warnings
import io
import atexit
from threading import Thread

import logging
logger = logging.getLogger('saspy')
Expand Down Expand Up @@ -72,10 +71,6 @@ def __init__(self, session, **kwargs):
self.reconuri = cfg.get('reconuri', None)
self.logbufsz = cfg.get('logbufsz', None)
self.log4j = cfg.get('log4j', '2.12.4')
self.keep = cfg.get('keepalive', None)

if self.keep:
self.keep = int(self.keep)

try:
self.outopts = getattr(SAScfg, "SAS_output_options")
Expand Down Expand Up @@ -266,13 +261,6 @@ def __init__(self, session, **kwargs):
else:
self.logbufsz = inlogsz

inkeep = kwargs.get('keepalive', None)
if inkeep:
if lock and self.keep:
logger.warning("Parameter 'keepalive' passed to SAS_session was ignored due to configuration restriction.")
else:
self.keep = int(inkeep)

self._prompt = session._sb.sascfg._prompt

return
Expand Down Expand Up @@ -588,11 +576,6 @@ def _startsas(self):
if self.sascfg.verbose:
logger.info("SAS Connection established. Subprocess id is "+str(pid)+"\n")

if self.sascfg.keep:
self._keep = Thread(target=self._keepalive_thread, args=())
self._keep.daemon = True
self._keep.start()

atexit.register(self._endsas)

return self.pid
Expand Down Expand Up @@ -653,9 +636,6 @@ def _endsas(self):
except:
pass

if self.sascfg.keep:
self._keep.join(1)

try: # Mac OS Python has bugs with this call
self.stdin[0].shutdown(socks.SHUT_RDWR)
except:
Expand Down Expand Up @@ -683,13 +663,6 @@ def _endsas(self):
self._sb.SASpid = None
return

def _keepalive_thread(self):
while True:
sleep(self.sascfg.keep * 60)
if self.pid is None:
return
self.submit('', results='text')

"""
def _getlog(self, wait=5, jobid=None):
logf = b''
Expand Down
2 changes: 1 addition & 1 deletion saspy/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '5.9.0'
__version__ = '5.10.0'

0 comments on commit bb12262

Please sign in to comment.