You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2020/08/21 02:15:47 UTC

[GitHub] [arrow] andygrove commented on pull request #8018: ARROW-9815 [Rust] [DataFusion] Fixed deadlock caused by accessing the scalar functions' registry.

andygrove commented on pull request #8018:
URL: https://github.com/apache/arrow/pull/8018#issuecomment-677999442


   Thanks @jorgecarleitao I think both approaches look good too. Another potential solution is just to put the mutex lock in a smaller scope by putting it in curly braces e.g.
   
   ```rust
   let scalar_functions = {
       ctx_state
                   .expect("failed to lock mutex")
                       .lock()
                   .scalar_functions
                       .expect("failed to lock mutex")
                   .lock()
                       .scalar_functions
                   .expect("failed to lock mutex")
                       .lock()
                   .get(name)
                       .expect("Unable to lock mutex")
               {
                       .clone()
   };
   ```
   
   This way, the mutex gets released within this block instead of being kept open.
   
   @alamb Yes, the locking is yet more tech debt to be addressed. These things need to be mutable due to the dynamic/interactive nature of the context, but I'm sure there is a cleaner solution.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org