You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Referring to issue #107
I have looked through the code and found that the only way that this error can happen
/app/node_modules/neo4j-driver/lib/v1/internal/ch-node.js:214
for (var i = 0; i < pending.length; i++) {
^
TypeError: Cannot read property 'length' of null
at /app/node_modules/neo4j-driver/lib/v1/internal/ch-node.js:214:34
...
is if the trust certificate callback is called twice:
this._handleConnectionError = this._handleConnectionError.bind(this);
-> this._conn = connect(opts, function () {
if (!self._open) {
return;
}
<...>
var pending = self._pending;
self._pending = null;
for (var i = 0; i < pending.length; i++) {
self.write(pending[i]);
}
}, this._handleConnectionError);
because it it setting self._pending to be null.
The trust certificate function can be called twice if the loadFingerprint callback is called twice.
After looking at the known_hosts file
But why are there duplicates?
Under the circumstances that the known_hosts file exists but is empty (manually created by someone) and if the app is calling for two (or more) driver sessions in the same process tick
The driver doesn't have time to update the known_hosts file and thus creates two (or more) entries of the same thing.
After that, the next session that is created:
Thanks so much for helping us investigating on this issue! So sorry we are running a bit low bandwidth to helping with the related issue #107 now.
We will come back to this and get it fixed next week. You are most welcome to send us a PR if you have got an idea in mind! If it is possible, please include a test to verify the PR have the correct fix and prevent the same problem from happening again.
Referring to issue #107
I have looked through the code and found that the only way that this error can happen
is if the trust certificate callback is called twice:
because it it setting
self._pending
to benull
.The trust certificate function can be called twice if the
loadFingerprint
callback is called twice.After looking at the
known_hosts
fileWe see that there are duplicate entries, causing this to fire more than once:
But why are there duplicates?
Under the circumstances that the
known_hosts
fileexists
but isempty
(manually created by someone) and if the app is calling for two (or more) driver sessions in the sameprocess tick
The driver doesn't have time to update the
known_hosts
file and thus creates two (or more) entries of the same thing.After that, the next session that is created:
will throw the error.
The text was updated successfully, but these errors were encountered: