holochain / lair

secret lair private keystore
Apache License 2.0
42 stars 11 forks source link

Lair is blocking on some requests #24

Closed mjbrisebois closed 3 years ago

mjbrisebois commented 3 years ago

Create requests seem to work consistently and then get requests for existing indexes also work. Index 0 and non-existing indexes block.

I discovered this blocking error while investigating a blocking call from Conductor to Lair (Sign by PubKey). Hopefully, that has the same root cause as this one.

const path = require('path');
const { structs, ...lair } = require('@holochain/lair-client');

(async () => {
    const LAIR_SOCKET = path.resolve( __dirname, "../tests/lair/socket" );
    const client = await lair.connect( LAIR_SOCKET );

    try {
        let req = new structs.TLS.GetCertByIndex.Request( 50 );
        console.log("Get cert by index:", await client.request( req ) );
    } catch (err) {
        console.error( err );
    } finally {
        client.destroy();
    }
})();

Lair logs - I can't see any reason for the blocking

Dec 09 15:16:53.093 TRACE lair_keystore_api::internal::ipc: notify new connection
Dec 09 15:16:53.093 TRACE lair_keystore_api::internal::ipc::low_level: ll read tick
Dec 09 15:16:53.093 TRACE handle_request: lair_keystore_api::internal::ipc: con write ToCliRequestUnlockPassphrase { msg_id: 10 }
Dec 09 15:16:53.093 TRACE lair_keystore_api::internal::ipc::low_level: ll wrote ToCliRequestUnlockPassphrase { msg_id: 10 }
Dec 09 15:16:53.093 TRACE lair_keystore_api::internal::ipc: await incoming request...
Dec 09 15:16:53.096 TRACE lair_keystore_api::internal::ipc::low_level: ll read count read=20
Dec 09 15:16:53.096 TRACE lair_keystore_api::internal::ipc::low_level: ll read peek size size=20
Dec 09 15:16:53.096 TRACE lair_keystore_api::internal::ipc::low_level: ll read ToLairTlsCertGetCertByIndex { msg_id: 0, keystore_index: KeystoreIndex(50) }
Dec 09 15:16:53.096 TRACE lair_keystore_api::internal::ipc::low_level: ll read tick
Dec 09 15:16:53.096 TRACE handle_low_level_send: lair_keystore_api::internal::ipc: RECV MSG msg=ToLairTlsCertGetCertByIndex { msg_id: 0, keystore_index: KeystoreIndex(50) }
Dec 09 15:16:53.096 TRACE lair_keystore_api::internal::ipc::low_level: ll read send done
neonphog commented 3 years ago

This should be addressed with the api rewrite first published in v0.1.0.