Hosts unreachable: Bulk data encryption algorithm failed in selected cipher suite

I’ve starting to experiment with api functions from algolia/algoliasearch-client-php (v1.22.0). I called the getObject with the id and I got the result back fine. But, if I repeat the same call again. I get this error. Any idea what’s happening?

AlgoliaSearch\AlgoliaConnectionException with message ‘Hosts unreachable: Bulk data encryption algorithm failed in selected cipher suite.,A PKCS #11 module returned CKR_DEVICE_ERROR, indicating that a problem has occurred with the token or slot.,A PKCS #11 module returned CKR_DEVICE_ERROR, indicating that a problem has occurred with the token or slot.,A PKCS #11 module returned CKR_DEVICE_ERROR, indicating that a problem has occurred with the token or slot.’

Hi Kenji,

Could you please attach the related code snippet so we could better investigate?
Thanks!

Hi @kenji,

Could you also check with version 1.21 to see if you have the same issue?

Thanks!

I found this is the problem of Laravel Tinker although I don’t know why. The same result with v1.21. It works fine outside of the tinker.

Psy Shell v0.7.2 (PHP 7.0.23 — cli) by Justin Hileman
>>> use AlgoliaSearch\Client;
=> null
>>> $c = new Client(config('local.algolia_id'), config('local.algolia_key'));
=> AlgoliaSearch\Client {#1388}
>>> $i = $c->initIndex('ec-2');
=> AlgoliaSearch\Index {#1381
     +indexName: "ec-2",
   }
>>> $i->getObject('2-24930');
=> [
     "id" => 24930,
...
>>> $i->getObject('2-24930');
AlgoliaSearch\AlgoliaConnectionException with message 'Hosts unreachable: Bulk data encryption algorithm failed in selected cipher suite.,A PKCS #11 module returned CKR_DEVICE_ERROR, indicating that a problem has occurred with the token or slot.,A PKCS #11 module returned CKR_DEVICE_ERROR, indicating that a problem has occurred with the token or slot.,A PKCS #11 module returned CKR_DEVICE_ERROR, indicating that a problem has occurred with the token or slot.'
>>>

This is really weird. Does it always happen the second time you get an object, or is it random?

Yes, it’s weird. Not random. It only works at the 1st time. I gets errors the 2nd, 3rd …
I’m using Laravel 5.2. I haven’t tested it with the newer versions. Can you recreate it with your environment?

I managed to reproduce this problem in Laravel 5.5. Happens the second time around indeed. Restarting the tinker and trying it again fixes it indeed. Ever managed to find out why this occurs?

1 Like