supabase / edge-runtime

A server based on Deno runtime, capable of running JavaScript, TypeScript, and WASM services.
MIT License
691 stars 62 forks source link

fix(sb_ai): Sessions are dropped while still in use #443

Closed kallebysantos closed 2 weeks ago

kallebysantos commented 2 weeks ago

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

The cleanup method can't verify if sessions created via op_sb_ai_ort_init_session() are still in use.

What is the new behavior?

This PR fixes this issue, by ensure that sessions created from op_sb_ai_ort_init_session() will have its reference stored in Worker's OpState. This guarantees that cleanup method will don't drop Sessions attached to an active worker.

Also was introduced a better error handling when it can't found a session.

Additional context

Solved: image

Trying to retrieve a session that was dropped while the worker was still consuming it

github-actions[bot] commented 2 weeks ago

:tada: This PR is included in version 1.62.2 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: