Menu

#2222 Multi-threading is broken in ogr-decode (fix provided)

2019.2
NeedInfo
nobody
threading (1)
Low
2020-04-27
2020-04-25
No

Problem: ogr-decode crashes when called with the --all-threads option on Linux (and probably other platforms) in terragear "next" branch.

Solution: remove calls to sglog() in a tg_contour subroutine called by ogr-decode. I have submitted a merge request against next that removes these calls. I probably added these calls originally in a previous merge request.

Related

Tickets: #2222

Discussion

  • James Turner

    James Turner - 2020-04-27

    Bit more info on this one: for there kind of infrequent operations on logging, we use a different tactic to ensure thread safety: we have a helper to pause the logging thread and restart it.

    I suspect something is not quite right in the pause logic. The idea for this slightly weird system is to avoid need a mutex to access would_log() - which is critical for performance since every log call checks that before doing string-formatting, to see if it should even bother doing the formatting.

    probably the cost of using a mutex (or some atomic ints) for log-level and log-prioirty is negligible here, but the PauseLog thing has been working for years, so it's weird that it's crashing in ogr-decode.

     
  • James Turner

    James Turner - 2020-04-27
    • status: New --> NeedInfo
     
  • James Turner

    James Turner - 2020-04-27

    More thinking : the PauseLog stuff doesn't actually protect from concurrent calls to setLoglevel itself. Likely we just need to gaurd against that. (You can't use m_lock for this, since it's the thread-control mutex, but you can add another mutex )

     
    • James Hester

      James Hester - 2020-04-27

      I think it makes sense to remove these calls anyway, as they are really
      debugging code that has been left in. But great if it helps to solve a
      multi-threading issue elsewhere.

      On Mon, 27 Apr 2020 at 18:20, James Turner jmturner@users.sourceforge.net
      wrote:

      More thinking : the PauseLog stuff doesn't actually protect from
      concurrent calls to setLoglevel itself. Likely we just need to gaurd
      against that. (You can't use m_lock for this, since it's the thread-control
      mutex, but you can add another mutex )


      Status: NeedInfo
      Milestone: 2019.2
      Labels: threading
      Created: Sat Apr 25, 2020 01:06 AM UTC by James Hester
      Last Updated: Mon Apr 27, 2020 08:05 AM UTC
      Owner: nobody

      Problem: ogr-decode crashes when called with the --all-threads option on
      Linux (and probably other platforms) in terragear "next" branch.

      Solution: remove calls to sglog() in a tg_contour subroutine called by
      ogr-decode. I have submitted a merge request against next that removes
      these calls. I probably added these calls originally in a previous merge
      request.


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/flightgear/codetickets/2222/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

      --
      T +61 (02) 9717 9907
      F +61 (02) 9717 3145
      M +61 (04) 0249 4148

       

      Related

      Tickets: #2222

  • James Turner

    James Turner - 2020-04-27

    Honestly I'm not so keen to touch this code, so if you have a work-around or it's debug stuff, I'd say let's go with that.

     
    • James Hester

      James Hester - 2020-04-27

      Yep, absolutely these log statements can be removed with no issues. I've
      just generated half of Queensland with them turned off.

      On Mon, 27 Apr 2020 at 23:41, James Turner jmturner@users.sourceforge.net
      wrote:

      Honestly I'm not so keen to touch this code, so if you have a work-around
      or it's debug stuff, I'd say let's go with that.


      Status: NeedInfo
      Milestone: 2019.2
      Labels: threading
      Created: Sat Apr 25, 2020 01:06 AM UTC by James Hester
      Last Updated: Mon Apr 27, 2020 08:20 AM UTC
      Owner: nobody

      Problem: ogr-decode crashes when called with the --all-threads option on
      Linux (and probably other platforms) in terragear "next" branch.

      Solution: remove calls to sglog() in a tg_contour subroutine called by
      ogr-decode. I have submitted a merge request against next that removes
      these calls. I probably added these calls originally in a previous merge
      request.


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/flightgear/codetickets/2222/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

      --
      T +61 (02) 9717 9907
      F +61 (02) 9717 3145
      M +61 (04) 0249 4148

       

      Related

      Tickets: #2222


Log in to post a comment.

MongoDB Logo MongoDB