Skip to content

Conversation

josegomezr
Copy link

Long running connections and strict firewall policies (one can argue that are not RFC compliant but that's besides the point) can incur in connections getting stalled forever.

Upon connecting to the OBS backend, every so minutes (5 min) to "keep the line up" when using a connection pool to interact with the OBS Backend.

Long running connections and strict firewall policies (one can argue
that are not RFC compliant but that's besides the point) can incur in
connections getting stalled forever.

Upon connecting to the OBS backend, every so minutes (5 min) to "keep
the line up".
Copy link
Owner

@mgerstner mgerstner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall I need to think this through some more, if there could be any multi-threading issues here. The osc module implements transparent connection reuse these days and multi-threaded access could break things.

oscfs/fs.py Outdated

@contextlib.contextmanager
def optional_keepalive(self):
if "--no-urlopen-wrapper" in sys.argv:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why couple this to --no-urlopen-wrapper?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No particular reason, I suspected the keepalive would be more impactful in conjunction with the urlopen wrapper but I can take it away.

oscfs/fs.py Outdated
direct_io=True,
nonempty=True
)
with self.optional_keepalive():
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like this contextlib approach very much. It is more or less misused here IMHO and it's hard to understand what it is about.

The thread could also be started in init(), I suppose. Shutdown, if necessary, could happen after FUSE returns.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made it so it was an "optional feature" trying to minimize the changes to the main routine by yielding.

Starting the thread on init indeed looks like a better alternative.

oscfs/fs.py Outdated
def run(self):
def _keepalive(self):
while self._keepalive:
time.sleep(5 * 60)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ping frequency should be a configurable command line argument

# unallocated file handles
self.m_free_handles = list(range(1024))
self._setupParser()
self._keepalive_timer = threading.Thread(target=self._keepalive_thread)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer the thread is started only if its actually needed, in the init() method as well.

Currently there is also a race, because the self._keepalive flag might be unset when the thread enters its loop.

@mgerstner
Copy link
Owner

Apart from the one comment I believe this might work now. Can you please address the problem and squash the commits you did so far? I will then make some runtime tests to see if it holds up in practice before I merge this. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants