Git Product home page Git Product logo

Comments (8)

majn avatar majn commented on July 24, 2024

Calling tgl_timer_insert multiple times shouldn't be an issue.

What the function appears to do is to iterate through all running queries to restart them. The reason why the function shows up multiple times is that tree.h implements it as a recursive function (https://github.com/vysheng/tgl/blob/master/tree.h#L133-L147).

from tgl.

majn avatar majn commented on July 24, 2024

There's something off about this. The issue appears to be caused by an assertion assert (-1 == t->fd), which is an assertion I'm not able to find anywhere in the code.

from tgl.

BenWiederhake avatar BenWiederhake commented on July 24, 2024

Of course it is an issue:

  • instantiation
  • call with insert, internal fd is set to
  • another call with insert, internal fd is set to
  • call to free, internal freeing stops the timer, but NOT the one.
  • timer fires, doing a use-after-free

from tgl.

BenWiederhake avatar BenWiederhake commented on July 24, 2024

That assertion is written by me.

I'm making the assumption that when insert is called, there should be no other timer currently being "ticking"

from tgl.

majn avatar majn commented on July 24, 2024

You are right, of course it shouldn't be called multiple times on the same timer_alarm struct.

from tgl.

majn avatar majn commented on July 24, 2024

I've debugged this issue and printed a stacktrace for every time timer insert is called, while using the same assertion as Ben.

https://gist.github.com/majn/0c69dd738d7690222489

Apparently, tgl_do_get_difference is executed for the first time and starts the regular alarm timeout of (6 seconds) and then when work_new_session_created is received, the second timeout (0.001s) is called on the same struct.

@vysheng Is this behavior by design and the timer implementation is supposed to cancel all pending timeouts on its own?

from tgl.

majn avatar majn commented on July 24, 2024

One more thing:

work_new_session_created appears to happen every time the tgl is started, restarting all running queries on every restart.

from tgl.

BenWiederhake avatar BenWiederhake commented on July 24, 2024

From @vysheng: The intended meaning of that was precisely like we assumed.

from tgl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.