<div dir="ltr"><div dir="ltr"><div><div>Hi Matt,<br><br></div>        Thanks a lot for the reply.</div><div> <br></div><div>       After calling ASYNC_pause_job() from the engine, control will transfer to the place where we start the ASYNC_start_job right? So how can we write the code to put a trigger on fd in the same thread? If I am wrong  please correct me. Also if u can suggest where resume operation should be done, it would be helpful.<br></div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Jan 10, 2019 at 10:11 PM Matt Caswell <<a href="mailto:matt@openssl.org">matt@openssl.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
On 10/01/2019 09:39, Ananthu Unnikrishnan wrote:<br>
> Hi all,<br>
> <br>
>         We are not able to access the waitctx address from the job address using<br>
> ASYNC_get_wait_ctx(job) from a thread which starts in the bind section of the<br>
> dynamic engine. The job address is the same as that we got<br>
> using ASYNC_get_current_job.  Can anyone help on this?<br>
<br>
It's very unclear from the your various emails what you are trying to achieve<br>
and the problem that you are experiencing.<br>
<br>
>From the above it sounds like you are starting threads from inside your dynamic<br>
engine? ASYNC_JOBs are always local to a thread. When a job is started it is<br>
associated with the current thread. So ASYNC_get_current_job() returns the job<br>
associated with the current thread. Similarly if you pause a job,<br>
ASYNC_pause_job() must be called from that same thread. Finally if you restart a<br>
paused job it must also be restarted on the same thread.<br>
<br>
If you are starting new threads from within your engine then extreme care must<br>
be taken to obey the above rules - otherwise you are likely to get strange results.<br>
<br>
Matt<br>
<br>
<br>
> <br>
>          <br>
> <br>
> On Tue, Jan 8, 2019 at 11:26 AM Ananthu Unnikrishnan <<a href="mailto:ananthuu741@gmail.com" target="_blank">ananthuu741@gmail.com</a><br>
> <mailto:<a href="mailto:ananthuu741@gmail.com" target="_blank">ananthuu741@gmail.com</a>>> wrote:<br>
> <br>
>     Can anyone please help on this? If u need any additional information please<br>
>     let me know.<br>
> <br>
>     On Mon, Jan 7, 2019 at 6:25 PM Ananthu Unnikrishnan <<a href="mailto:ananthuu741@gmail.com" target="_blank">ananthuu741@gmail.com</a><br>
>     <mailto:<a href="mailto:ananthuu741@gmail.com" target="_blank">ananthuu741@gmail.com</a>>> wrote:<br>
> <br>
>         Hi all,<br>
> <br>
>         Adding more details to the previous mail. We have edited the OpenSSL<br>
>         code for implementing the polling for changed fd's as in OpenSSL speed<br>
>         command. Attached the code snippet of the same along with this mail.<br>
>         Mentioned below some observations which found doubtful:<br>
> <br>
>         1) We have got prints in ASYNC_FINISH case, before getting print in<br>
>         ASYNC_PAUSE case. Attaching the log also, so you can understand easily. <br>
>         2) Shown below the code snippet which we have written to provide a write<br>
>         on fd.<br>
> <br>
>         if ((waitctx = ASYNC_get_wait_ctx((ASYNC_JOB *)job)) == NULL) {<br>
>                 printf("In dynamic engine | waitctx == NULL : %d\n", __LINE__);<br>
>                 return ret;<br>
>             }<br>
> <br>
>             printf("\n----- In dynamic engine | After pausing | job is %lx | <br>
>         waitctx in resume job %lx |-----\n", job, waitctx);<br>
> <br>
>                 if ((ret = ASYNC_WAIT_CTX_get_fd(waitctx, engine_id, &efd,<br>
>                                       &custom)) > 0) {<br>
>                 if (write(efd, &buf, sizeof(uint64_t)) == -1) {<br>
>                     printf("\nFailed to write\n");<br>
>                 }<br>
>             }<br>
> <br>
>         Here waitctx is getting NULL when we tried to fetch waitctx using<br>
>         ASYNC_get_wait_ctx(). We have printed data of sizeof(ASYNC_JOB) ie.1176<br>
>         bytes contained in the job address from the engine,  we got correct data<br>
>         before calling ASYNC_pause() and but got half data zero data when we<br>
>         tried to access the same address after ASYNC_pause(). <br>
> <br>
>         Attaching both job structure contents before and after calling<br>
>         ASYNC_pause(). Also, we got the correct data in the same address when we<br>
>         have printed from ssl_start_async_job() before polling starts, where we<br>
>         have started the async_job<br>
>         . <br>
>         The prints starting with "In dynamic engine" are prints inside the<br>
>         engine, rest prints are from ss/ssl_lib.c. Kindly check this and please<br>
>         point out if anything is wrong somewhere. Thanks in advance.<br>
> <br>
> <br>
>         On Sun, Jan 6, 2019 at 10:30 AM Ananthu Unnikrishnan<br>
>         <<a href="mailto:ananthuu741@gmail.com" target="_blank">ananthuu741@gmail.com</a> <mailto:<a href="mailto:ananthuu741@gmail.com" target="_blank">ananthuu741@gmail.com</a>>> wrote:<br>
> <br>
>             Hi all,<br>
> <br>
>                    We have implemented a dynamic engine and tested in the async<br>
>             mode using OpenSSL speed command. But in a real network scenario, we<br>
>             have seen only starting the async_job(in file ssl/ssl_lib.c,<br>
>             function: ssl_start_async_job) in the OpenSSL. We haven't seen<br>
>             polling async_fd's for resuming the job as in apps/speed.c(in speed<br>
>             command case).<br>
>                     So can anyone please suggest any solution for resuming the<br>
>             async_jobs in real network scenario? Thanks in advance.<br>
> <br>
> <br>
> <br>
> <br>
> <br>
>         -- <br>
>         With best Regards, <br>
> <br>
>                  Ananthu<br>
> <br>
> <br>
> <br>
> <br>
>     -- <br>
>     With best Regards, <br>
> <br>
>              Ananthu<br>
> <br>
> <br>
> <br>
> <br>
> -- <br>
> With best Regards, <br>
> <br>
>          Ananthu<br>
> <br>
> <br>
> <br>
-- <br>
openssl-users mailing list<br>
To unsubscribe: <a href="https://mta.openssl.org/mailman/listinfo/openssl-users" rel="noreferrer" target="_blank">https://mta.openssl.org/mailman/listinfo/openssl-users</a><br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>With best Regards, </div><div><br></div>         Ananthu<br><div><br><br></div></div></div></div>