toptobes opened a new pull request, #462:
URL: https://github.com/apache/cassandra-nodejs-driver/pull/462

   This PR superceeds Jane He's #430 with her blessing
   
   After some investigation, we were unable to figure out the root cause behind 
the NPEs, with there being multiple potential avenues where the issue may have 
originated from, and so we decided to fix the issue at the lowest and simplest 
level we could–simply adding a stronger concurrency control to `_refresh` 
directly via a `_refreshInProgress` flag
   
   I personally believe the issue stemmed from `_setHealthListeners` being 
called multiple times on the same host/connection, causing the listeners to 
trigger refreshes multiple times for the same event, leading to the NPEs 
mentioned in the ticket. 
   However the issue is quite hard to organically reproduce so the theory 
remains a theory.
   
   <details>
   <summary>Potential trace</summary>
   <ol>
   <li> _refresh() is called
   <li>  _refresh() calls _refreshControlConnection()
   <li> _refreshControlConnection() fails to borrow a connection so it calls 
_initializeConnection()
   <li> _initializeConnection() calls _setHealthListeners() 
   <li> _refresh() gets back in control and then also calls 
_setHealthListeners()
   </ol>
   
   which means that there's the potential of, sequentially:
   
   <ol>
   <li> A new host and connection being set (call them H1 and C1)
   <li> Listeners being attached to the H1 and C1
   <li> A newer host being set (call it H2)
   <li> Listeners being attached to the H2 and C1 without the previous 
listeners being removed
   </ol>
   </details>


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to