The only problem I see with this change is that now, you can be certain 
that methods that control state are called only and only if the previous 
state was completely reached.
But if this is introduced that certainty is gone, more work for the end 
user, like always, exceptions should be treated like what they are ... 
"exceptions"

There are certain ugly frameworks out there which I don't think Akka 
toolskit should do an effort to fix them (indirectly I mean), I have to 
deal with them and it sucks but it is what it is
with such frameworks, if postStop (when preStart failed half way) is not 
called it might be even be a good thing because some frameworks could reach 
a stall mode if start failed and stop is called.

I strongly believe these exceptional cases should be handled by the user.
The example of stream is not a good because streams are idempotent, I wish 
all frameworks were but ...most frameworks are not.

Guido.

On Thursday, March 31, 2016 at 1:41:04 PM UTC+1, drewhk wrote:
>
> This is certainly not a change for a minor version, you implicitly assumed 
> it but it was never the intention. We only change semantics in minors if 
> either
>  - the code is experimental and the change is highly desired
>  - the existing semantics are considered a bug
>
> -Endre
>
> On Thu, Mar 31, 2016 at 2:39 PM, Guido Medina <[email protected] 
> <javascript:>> wrote:
>
>> I was exalting scenario with "legacy code life miserable" meant: *Code 
>> that relied already on the current contract, no offense meant ;-)*
>>
>> On Thursday, March 31, 2016 at 1:35:24 PM UTC+1, drewhk wrote:
>>
>>>
>>>
>>> On Thu, Mar 31, 2016 at 2:23 PM, Guido Medina <[email protected]> wrote:
>>>
>>>> so, say:
>>>>
>>>> Object a = null, Object b = null;
>>>>
>>>> preStart():
>>>>
>>>>   a = new something(); a.start(); *<= say I failed here.*
>>>>   b = new somethingElse(); b start();
>>>>
>>>> postStop():
>>>>
>>>>   b.stop(); boom NPE.
>>>>
>>>
>>> And this could be swallowed then by Akka and properly logged:
>>>
>>> "preStart() failed, attempted to cleanup via postStop() which then 
>>> failed with: $ex"
>>>  
>>>
>>>>   a.stop();
>>>>
>>>> That's why the word transaction exist right? A unit is considered 
>>>> started or valid of all its parts are valid and started...
>>>>
>>>
>>> and now you no longer able to do a compensating action (cleanup in 
>>> postStop if you grabbed external resources) because postStop is not called. 
>>> The transaction analogy falls apart here because there is no compensating 
>>> action available.
>>>  
>>>
>>>> But go ahead, make legacy code life miserable...the decision is yours.
>>>>
>>>
>>> I chose not being offended here ;) Can you elaborate on what would make 
>>> here legacy code life miserable?
>>>
>>> -Endre
>>>  
>>>
>>>>
>>>> Try catch is there for a reason but somehow magic exists.
>>>>
>>>> Guido.
>>>>
>>>> On Thursday, March 31, 2016 at 1:15:27 PM UTC+1, drewhk wrote:
>>>>
>>>>>
>>>>>
>>>>> On Thu, Mar 31, 2016 at 2:10 PM, Guido Medina <[email protected]> 
>>>>> wrote:
>>>>>
>>>>>> I haven't seen any system stopping something consciously that it was 
>>>>>> unable to start, the created instance is just an instance like another 
>>>>>> other object which will be GCed.
>>>>>>
>>>>>
>>>>> I don't agree, you might have opened a file or socket in the 
>>>>> constructor or parts of preStart() before the exception.
>>>>>  
>>>>>
>>>>>> If you look at it from a state machine perspective Status: CREATED => 
>>>>>> CALL START (or preStart don't worry about details) => Status: Started
>>>>>>
>>>>>> It is more destructive to call postStop if it didn't actually started 
>>>>>> because then you will get NPE for stopping things that are part of the 
>>>>>> actor that weren't instantiated. 
>>>>>>
>>>>> Now I have to protect my code from Akka calling postStop...see my 
>>>>>> point?
>>>>>>
>>>>>
>>>>> Nope, Akka should just swallow the double-fault at that point. I still 
>>>>> think it should at least attempt to call postStop() to mitigate resource 
>>>>> leaks.
>>>>>
>>>>> -Endre
>>>>>  
>>>>>
>>>>>>
>>>>>> Guido.
>>>>>>
>>>>>> On Thursday, March 31, 2016 at 9:19:15 AM UTC+1, drewhk wrote:
>>>>>>>
>>>>>>> That description suits me ;)
>>>>>>>
>>>>>>> On Thu, Mar 31, 2016 at 10:18 AM, Patrik Nordwall <
>>>>>>> [email protected]> wrote:
>>>>>>>
>>>>>>>> From the source: "Only change this if you're very confident and 
>>>>>>>> lucky" :-)
>>>>>>>>
>>>>>>>> On Thu, Mar 31, 2016 at 9:30 AM, Endre Varga <
>>>>>>>> [email protected]> wrote:
>>>>>>>>
>>>>>>>>> Shouldn't we all postStop there if preStart has been at least 
>>>>>>>>> invoked (i.e. there is already an instance)? It does not seem to be 
>>>>>>>>> hard, 
>>>>>>>>> just shuffling that code a bit around (famous last words?).
>>>>>>>>>
>>>>>>>>> On Thu, Mar 31, 2016 at 9:25 AM, Patrik Nordwall <
>>>>>>>>> [email protected]> wrote:
>>>>>>>>>
>>>>>>>>>> I think that is how it is implemented. Exception from preStart 
>>>>>>>>>> results in clearing the actor field and 
>>>>>>>>>> throwing ActorInitializationException:
>>>>>>>>>>
>>>>>>>>>> https://github.com/akka/akka/blob/master/akka-actor/src/main/scala/akka/actor/ActorCell.scala#L599
>>>>>>>>>>
>>>>>>>>>> Default supervision will result in stop, but postStop is not 
>>>>>>>>>> called because the actor field was cleared: 
>>>>>>>>>> https://github.com/akka/akka/blob/master/akka-actor/src/main/scala/akka/actor/dungeon/FaultHandling.scala#L210
>>>>>>>>>>
>>>>>>>>>> On Wed, Mar 30, 2016 at 10:59 AM, Endre Varga <
>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On Sun, Mar 27, 2016 at 5:52 PM, Stanislav Savulchik <
>>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Hi, everyone! 
>>>>>>>>>>>>
>>>>>>>>>>>> I've discovered that Actor's postStop method doesn't get 
>>>>>>>>>>>> invoked if exception occurs during actor initialization via 
>>>>>>>>>>>> preStart 
>>>>>>>>>>>> method. Does anyone know if it is the correct behavior? I expected 
>>>>>>>>>>>> that the 
>>>>>>>>>>>> failed actor could close some resources in postStop.
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Do you have a reproducer for this? I would also expect postStop 
>>>>>>>>>>> to be at least attempted to be called.
>>>>>>>>>>>  
>>>>>>>>>>>
>>>>>>>>>>>> P.S. The behavior differs when a failure occurs during regular 
>>>>>>>>>>>> vs. system message processing and supervisor decides to Stop the 
>>>>>>>>>>>> failed 
>>>>>>>>>>>> child. It seems inconsistent to me.
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> What do you mean here? Can you provide a small example to show 
>>>>>>>>>>> this?
>>>>>>>>>>>  
>>>>>>>>>>>
>>>>>>>>>>>> -- 
>>>>>>>>>>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>>>> >>>>>>>>>> Check the FAQ: 
>>>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>>> >>>>>>>>>> Search the archives: 
>>>>>>>>>>>> https://groups.google.com/group/akka-user
>>>>>>>>>>>> --- 
>>>>>>>>>>>> You received this message because you are subscribed to the 
>>>>>>>>>>>> Google Groups "Akka User List" group.
>>>>>>>>>>>> To unsubscribe from this group and stop receiving emails from 
>>>>>>>>>>>> it, send an email to [email protected].
>>>>>>>>>>>> To post to this group, send email to [email protected].
>>>>>>>>>>>> Visit this group at https://groups.google.com/group/akka-user.
>>>>>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> -- 
>>>>>>>>>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>>> >>>>>>>>>> Check the FAQ: 
>>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>> >>>>>>>>>> Search the archives: 
>>>>>>>>>>> https://groups.google.com/group/akka-user
>>>>>>>>>>> --- 
>>>>>>>>>>> You received this message because you are subscribed to the 
>>>>>>>>>>> Google Groups "Akka User List" group.
>>>>>>>>>>> To unsubscribe from this group and stop receiving emails from 
>>>>>>>>>>> it, send an email to [email protected].
>>>>>>>>>>> To post to this group, send email to [email protected].
>>>>>>>>>>> Visit this group at https://groups.google.com/group/akka-user.
>>>>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> -- 
>>>>>>>>>>
>>>>>>>>>> Patrik Nordwall
>>>>>>>>>> Akka Tech Lead
>>>>>>>>>> Lightbend <http://www.lightbend.com/> -  Reactive apps on the JVM
>>>>>>>>>> Twitter: @patriknw
>>>>>>>>>>
>>>>>>>>>> [image: Lightbend] <http://www.lightbend.com/>
>>>>>>>>>>
>>>>>>>>>> -- 
>>>>>>>>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> >>>>>>>>>> Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> >>>>>>>>>> Search the archives: 
>>>>>>>>>> https://groups.google.com/group/akka-user
>>>>>>>>>> --- 
>>>>>>>>>> You received this message because you are subscribed to the 
>>>>>>>>>> Google Groups "Akka User List" group.
>>>>>>>>>> To unsubscribe from this group and stop receiving emails from it, 
>>>>>>>>>> send an email to [email protected].
>>>>>>>>>> To post to this group, send email to [email protected].
>>>>>>>>>> Visit this group at https://groups.google.com/group/akka-user.
>>>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> -- 
>>>>>>>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>> >>>>>>>>>> Check the FAQ: 
>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>> >>>>>>>>>> Search the archives: 
>>>>>>>>> https://groups.google.com/group/akka-user
>>>>>>>>> --- 
>>>>>>>>> You received this message because you are subscribed to the Google 
>>>>>>>>> Groups "Akka User List" group.
>>>>>>>>> To unsubscribe from this group and stop receiving emails from it, 
>>>>>>>>> send an email to [email protected].
>>>>>>>>> To post to this group, send email to [email protected].
>>>>>>>>> Visit this group at https://groups.google.com/group/akka-user.
>>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> -- 
>>>>>>>>
>>>>>>>> Patrik Nordwall
>>>>>>>> Akka Tech Lead
>>>>>>>> Lightbend <http://www.lightbend.com/> -  Reactive apps on the JVM
>>>>>>>> Twitter: @patriknw
>>>>>>>>
>>>>>>>> [image: Lightbend] <http://www.lightbend.com/>
>>>>>>>>
>>>>>>>> -- 
>>>>>>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>> >>>>>>>>>> Check the FAQ: 
>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>> >>>>>>>>>> Search the archives: 
>>>>>>>> https://groups.google.com/group/akka-user
>>>>>>>> --- 
>>>>>>>> You received this message because you are subscribed to the Google 
>>>>>>>> Groups "Akka User List" group.
>>>>>>>> To unsubscribe from this group and stop receiving emails from it, 
>>>>>>>> send an email to [email protected].
>>>>>>>> To post to this group, send email to [email protected].
>>>>>>>> Visit this group at https://groups.google.com/group/akka-user.
>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>
>>>>>>>
>>>>>>> -- 
>>>>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>> >>>>>>>>>> Check the FAQ: 
>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>> >>>>>>>>>> Search the archives: 
>>>>>> https://groups.google.com/group/akka-user
>>>>>> --- 
>>>>>> You received this message because you are subscribed to the Google 
>>>>>> Groups "Akka User List" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it, 
>>>>>> send an email to [email protected].
>>>>>> To post to this group, send email to [email protected].
>>>>>> Visit this group at https://groups.google.com/group/akka-user.
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>
>>>>> -- 
>>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>>> >>>>>>>>>> Check the FAQ: 
>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>> >>>>>>>>>> Search the archives: 
>>>> https://groups.google.com/group/akka-user
>>>> --- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "Akka User List" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to [email protected].
>>>> To post to this group, send email to [email protected].
>>>> Visit this group at https://groups.google.com/group/akka-user.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>> -- 
>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>> >>>>>>>>>> Check the FAQ: 
>> http://doc.akka.io/docs/akka/current/additional/faq.html
>> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Akka User List" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to