intel / asynch_mode_nginx

Other
211 stars 62 forks source link

[emerg] ENGINE_by_id("qatengine") failed #84

Open Edelweiss014 opened 3 weeks ago

Edelweiss014 commented 3 weeks ago

Hi there,

I am trying to build my own project by merging codes of asynch_mode_nginx into my Nginx 1.21.4 (with some additional codes written by myself). I also built my intel-ipsec-mb, ipp-crypto-mb and then QAT_Engine on my own environment. Since I only need SW acceleration, my Nginx conf looks like:

ssl_engine {
    use_engine qatengine;
    default_algorithms RSA,EC,DH,DSA;
    qat_engine {
        qat_offload_mode async;
        qat_notify_mode poll;
        qat_poll_mode heuristic;
        qat_sw_fallback on;
    }
}

But when I tried to start Nginx, I got:

nginx: [emerg] ENGINE_by_id("qatengine") failed
nginx: [emerg] ssl engine send ctrl failed
nginx: [emerg] ssl engine set failed

I am not sure about the reason: does it mean that I did not install QAT engine successfully? Do I need to specify the QAT engine dir when I rebuild my Nginx?

Thank you very much!

hardikpatel9 commented 2 weeks ago

Hi @Edelweiss014 ,

Yes, it is required, By looking error, It could be QAT Engine not being installed correctly, or the QAT engine not being available in the expected directory, or a misconfiguration in the Nginx setup. Please Install QAT Engine with Specify QAT Engine Directory and export (ex:- export OPENSSL_ENGINES/_LIB=/path/to/qat/engine) or give absolute path,

To compile the Nginx you can use the below sample example configuration, ./configure \ --prefix=$NGINX_INSTALL_DIR \ --with-http_ssl_module \ --add-dynamic-module=modules/nginx_qat_module/ \ --with-cc-opt="-DNGX_SECURE_MEM -I$OPENSSL_LIB/include -Wno-error=deprecated-declarations" \ --with-ld-opt="-Wl,-rpath=$OPENSSL_LIB/lib64 -L$OPENSSL_LIB/lib64"

So here, the QAT Engine library should be compiled and should be linked along with OPENSSL_LIB/lib64, For it you can either export the variable or give an absolute hard code path to link the compiled QAT Engine Lib

Edelweiss014 commented 1 week ago

Hi @Edelweiss014 ,

Yes, it is required, By looking error, It could be QAT Engine not being installed correctly, or the QAT engine not being available in the expected directory, or a misconfiguration in the Nginx setup. Please Install QAT Engine with Specify QAT Engine Directory and export (ex:- export OPENSSL_ENGINES/_LIB=/path/to/qat/engine) or give absolute path,

To compile the Nginx you can use the below sample example configuration, ./configure --prefix=$NGINX_INSTALL_DIR --with-http_ssl_module --add-dynamic-module=modules/nginx_qat_module/ --with-cc-opt="-DNGX_SECURE_MEM -I$OPENSSL_LIB/include -Wno-error=deprecated-declarations" --with-ld-opt="-Wl,-rpath=$OPENSSL_LIB/lib64 -L$OPENSSL_LIB/lib64"

So here, the QAT Engine library should be compiled and should be linked along with OPENSSL_LIB/lib64, For it you can either export the variable or give an absolute hard code path to link the compiled QAT Engine Lib

Hi @hardikpatel9,

Thank a lot for your reply! I tried export expression but still failed... Just for double check, is the engine path look like: $OPENSSL_LIB/lib/engines-1.1? I have tried something like /usr/local/openssl/engines-1.1, but it didn't seem to work.

Edelweiss014 commented 1 week ago

Add for reference, my qatengine directory looks like:

/usr/local/openssl
    |_ lib
         |_ engines-1.1
                     |_ qatengine.la
                     |_ qatengine.so

Is this a successful installation?

hardikpatel9 commented 1 week ago

Hello @Edelweiss014 , The Lib seems okay. Since you require SW acceleration only, you can remove the qat_sw_fallback. Just for cross-verification of whether the QAT engine .so is pointing correctly or not, you can also use a different path, like /root/setup/SSL/lib64/engines-3/