mount

dm3 2017-03-08T17:46:51.000848Z

I sometimes run into issues where a state gets corrupted after start so stop throws

dm3 2017-03-08T17:47:12.000850Z

then I’m unable to restart as stop always fails

dm3 2017-03-08T17:47:33.000851Z

what’s the best way to avoid the cleanup-if-dirty phase?

dm3 2017-03-08T17:50:43.000852Z

I guess it’s covered by https://github.com/tolitius/mount/issues/63

tolitius 2017-03-08T20:48:24.000854Z

@dm3: yea, there are options covered in this issue, but I would still like to find a solution and document it, since it is a valid concern. so ideas are very welcome

tolitius 2017-03-08T21:56:22.000855Z

@dm3 there are also some related thoughts: https://github.com/tolitius/mount/issues/50

dm3 2017-03-08T22:08:53.000858Z

I don’t think Mount should be doing anything to manage failures in non-dev deployments

dm3 2017-03-08T22:09:58.000859Z

this can be built as convenience on top

dm3 2017-03-08T22:10:27.000860Z

however in development the states are sometimes clobbered which prevents them from being stopped

dm3 2017-03-08T22:10:31.000861Z

and currently there’s no way out

dm3 2017-03-08T22:11:03.000862Z

so I’d vote for something like reset

dm3 2017-03-08T22:11:32.000863Z

hm, does it even make sense to stop the stop action if something throws?

dm3 2017-03-08T22:12:04.000864Z

you can’t do much at this point

dm3 2017-03-08T22:13:12.000865Z

it might then make sense to make stop do best-effort of stopping everything that didn’t throw

dm3 2017-03-08T22:17:35.000866Z

I guess if we had something like reset - Stop all started states unconditionally and clear the internal Mount state

dm3 2017-03-08T22:18:05.000867Z

stop could keep its current behaviour

dm3 2017-03-08T22:18:12.000868Z

@tolitius what do you think?

tolitius 2017-03-08T22:21:47.000869Z

> Stop all started states unconditionally and clear the internal Mount state yea, that is what I had in mind for something like (mount/reset :ignore-errors true) or just (mount/reset)

dm3 2017-03-08T22:22:55.000870Z

I’m still thinking what I’d like my system to do if one of the states fails to stop during shutdown

dm3 2017-03-08T22:23:36.000872Z

on start it’s easy - I don’t want the system to start up in a broken state

dm3 2017-03-08T22:23:49.000873Z

on stop it seems I’d like to stop as much as I can cleanly

tolitius 2017-03-08T22:24:29.000875Z

I think this decision (what to do on a failed stop) is best left to "a developer", since use cases are different, but stop as much as I can could be a useful option

dm3 2017-03-08T22:24:44.000876Z

that’d probably be my default

tolitius 2017-03-08T22:25:01.000877Z

resources that are still "connected" would be a problem though

dm3 2017-03-08T22:25:28.000878Z

yeah, you could still throw an “accumulated” exception once stop is done

tolitius 2017-03-08T22:26:25.000879Z

but yea, "reset" would work ok for things that just throw the exception, but do not tie up any resources

dm3 2017-03-08T22:26:38.000880Z

yes

dm3 2017-03-08T22:26:42.000881Z

reset is for development

tolitius 2017-03-08T22:27:32.000882Z

might make sense to not lose references to "states" in a bad "state" though..

dm3 2017-03-08T22:28:07.000883Z

what do you mean?

tolitius 2017-03-08T22:28:42.000884Z

i.e. say you have a conn to db that threw on stop: i.e. could not disconnect

tolitius 2017-03-08T22:29:07.000885Z

would still be good to return that reference after the internal mount references are "reset"

tolitius 2017-03-08T22:29:31.000886Z

since something may still be possible at repl time: i.e. to force disconnect it

dm3 2017-03-08T22:29:55.000887Z

I’d think you would work with start/stop

dm3 2017-03-08T22:30:03.000888Z

then once stop failed you’d try reset

tolitius 2017-03-08T22:30:25.000889Z

right, but it would mean a stale reference to something that is still connected

dm3 2017-03-08T22:30:27.000890Z

so after stop fails you can still do whatever is needed

tolitius 2017-03-08T22:30:40.000891Z

you can, but you would not be able to reconnect

tolitius 2017-03-08T22:30:54.000892Z

due to, say, a bound port

dm3 2017-03-08T22:31:13.000893Z

could you not do force disconnect after stop failed?

dm3 2017-03-08T22:31:27.000894Z

or is the state lost at that point?

tolitius 2017-03-08T22:32:42.000895Z

right, if we are talking about a "reset": i.e. stop everything, even if it has failed, the original reference to conn would point to something like a NotStartedState vs. the actual problem state

tolitius 2017-03-08T22:33:20.000896Z

so I am thinking it would make sense to still return (new) references to failed states

dm3 2017-03-08T22:33:21.000897Z

yeah, that’s fine by me because you have a chance to “force disconnect” after mount/stop failed

dm3 2017-03-08T22:33:27.000898Z

unless I misunderstand something

tolitius 2017-03-08T22:33:32.000899Z

right, as long as you have a reference

dm3 2017-03-08T22:33:51.000900Z

when do you lose the reference?

dm3 2017-03-08T22:33:59.000901Z

is it lost after mount/stop fails?

tolitius 2017-03-08T22:34:59.000902Z

no, it is lost if stop succeeds 🙂 but if we are to do a "reset" regardless, the reference would be lost

tolitius 2017-03-08T22:35:41.000903Z

> it is lost if stop succeeds it would point to a DerefableState or NotStartedState after a successful call to "stop"

dm3 2017-03-08T22:36:56.000906Z

ok

tolitius 2017-03-08T22:40:02.000908Z

yea, it's good food for thought. I'll start adding a "reset" this would prompt me to think more about it. thanks for bringing it up

dm3 2017-03-08T22:41:25.000910Z

what I’m trying to say is that a) reset is mostly useful in the development workflow b) reset shouldn’t be used instead of stop, rather you use start/stop and when stop fails you do reset once you clean stuff up However, I see how you could return a set of Vars which failed to stop on reset which might be helpful

tolitius 2017-03-08T22:41:57.000911Z

yep, exactly

tolitius 2017-03-08T22:42:33.000912Z

or should I say precisely.. always confuse the two