Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Bug reports ➜ Crashed without any message

Crashed without any message

It is now over 60 days since the last post. This thread is closed.     Refresh page


Pages: 1  2 

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #15 on Fri 24 Jul 2015 11:24 PM (UTC)
Message
I don't understand why you are using "wait.make" here. None of the code you have uses the wait functions, so that is just adding unnecessary complexity.

I changed your code to:


function restart()
  ResetPlugin()
  -- Do something here.
  -- When we need to restart, we setup a timer to check it
  if IsTimer("restart_timer") ~= 0 then
    AddTimer("restart_timer", 0, 0, 3, "", timer_flag.Enabled, "restart_timer_func")
  else
    EnableTimer("restart_timer", true)
  end
end

function restart_timer_func()
  -- Do restart check here
  Note("restart now")
  EnableTimer("restart_timer", false)
  DoAfterSpecial(0.1, "restart", 10)
end


That didn't crash.

Also, what is it doing? The alias "restart" calls restart(), that adds a timer that calls restart_timer_func(), that calls restart() and so on. What does it all mean?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #16 on Sat 25 Jul 2015 02:19 AM (UTC)
Message

DoAfterSpecial(0.1, "restart", 10)

...
function restart()
  ResetPlugin()
...

function ResetPlugin()
  DeleteTemporaryTriggers()
  DeleteTemporaryTimers()
  DeleteTemporaryAliases()
end


DoAfterSpecial creates a temporary timer. Then when that calls restart() that calls ResetPlugin() which deletes the timer which has the script which is currently running. Hence the client crashes. Don't do that.

I have added guard code into version 4.99 to not allow a temporary timer to be deleted if a script is running from it.

https://github.com/nickgammon/mushclient/commit/3386efc

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Jcl   (42 posts)  Bio
Date Reply #17 on Tue 28 Jul 2015 01:03 PM (UTC)

Amended on Tue 28 Jul 2015 01:04 PM (UTC) by Jcl

Message
Nick Gammon said:

I don't understand why you are using "wait.make" here. None of the code you have uses the wait functions, so that is just adding unnecessary complexity.

I changed your code to:


function restart()
  ResetPlugin()
  -- Do something here.
  -- When we need to restart, we setup a timer to check it
  if IsTimer("restart_timer") ~= 0 then
    AddTimer("restart_timer", 0, 0, 3, "", timer_flag.Enabled, "restart_timer_func")
  else
    EnableTimer("restart_timer", true)
  end
end

function restart_timer_func()
  -- Do restart check here
  Note("restart now")
  EnableTimer("restart_timer", false)
  DoAfterSpecial(0.1, "restart", 10)
end


That didn't crash.

Also, what is it doing? The alias "restart" calls restart(), that adds a timer that calls restart_timer_func(), that calls restart() and so on. What does it all mean?


I did some quests by the plugin. The procedure is nested loop, and possible to pause in a given situation.
When paused, it need to be restarted at some special conditions and delete temporaries.

The code "wait.make" is needed to do someting at
-- Do something here.
and
-- Do restart check here
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #18 on Tue 28 Jul 2015 08:41 PM (UTC)
Message
Oh OK. Well I think the big problem is deleting the temporary timers.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Jcl   (42 posts)  Bio
Date Reply #19 on Wed 29 Jul 2015 09:13 AM (UTC)
Message
Nick Gammon said:

Oh OK. Well I think the big problem is deleting the temporary timers.


I had tried to change
DoAfterSpecial(0.1, "restart", 10)
to
Execute("restart")
.

"DoAfterSpecial" cause to crash immediately, and "Execute" probably cause to crash at an unknown time after running normally for long times.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


69,588 views.

This is page 2, subject is 2 pages long:  [Previous page]  1  2 

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.