Subject: | Using multiple instances of the Crypt::U2F::Server::Simple object results in lots of "refCount error! Aborting everything!" errors |
I'm creating a new instance of the object per request I get on my server. After the first object when they are destroyed I'm seeing the warning 'refCount error! Aborting everything!'.
It looks like the intention is to keep track of how many objects are in scope, and when they have all gone run the teardown. You're not incrementing the refcount on subsequent object creations so it ends up with the refcount going negative triggering that warning and allowing things to be in a weird state where the initialisation hasn't run (and never will again) and objects try to do stuff.
It looks like simply moving the refcount increment should fix the issue.
Subject: | refcount.patch |
diff -Naur Crypt-U2F-Server-0.44/lib/Crypt/U2F/Server/Simple.pm Crypt-U2F-Server-0.45/lib/Crypt/U2F/Server/Simple.pm
--- Crypt-U2F-Server-0.44/lib/Crypt/U2F/Server/Simple.pm 2019-04-28 14:37:27.000000000 +0100
+++ Crypt-U2F-Server-0.45/lib/Crypt/U2F/Server/Simple.pm 2019-05-04 13:53:56.371420332 +0100
@@ -44,8 +44,8 @@
$errstr = Crypt::U2F::Server::u2fclib_getError();
return;
}
- $refCount++;
}
+ $refCount++;
my $ctx = Crypt::U2F::Server::u2fclib_get_context();
if ( !defined($ctx) || !$ctx ) {