New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move synth reason between workspaces from vcl_pipe #3330
Conversation
In vcl_pipe req is read-only and we operate bereq as a busy object, as a result we use the busy object's workspace to back VCL expressions. When we use the synth transition we may build a reason field on the wrong workspace since vcl_synth carries on in a client context. It is possible to notice that the reason string belongs to the backend workspace and make a copy inside the client workspace before the former is released. Fixes varnishcache#3329
I can see how this fixes #3329, but I wonder if we should really point-fix it. What about, for example, if we used That is to say, wouldn't it make sense to go all the way and move |
We had an informal review in my team and my conclusion is that we should probably keep the backend workspace around (and as such the busyobj). If we jump to edit: and add a |
@Dridi the point I wanted to make with my last comment is that |
I don't think it's a good idea to spawn a thread for a transaction that can virtually last forever, holding onto a client thread while at it. If anything, I could see us going the other way around and make the pipe transaction strictly a client-side thing where either the busyobj and all the privs are managed inside
I would rather think that the |
Re @Dridi I did not mean to suggest to run pipe in another thread. |
We've discussed it offline but instead of trying to move things between workspaces I would either consider Keeping open for the sake of discussion. |
in VRT_priv_task() we asserted that only one of ctx->req and ctx->bo is set when not in vcl_pipe {}, but we also need to extend that assertion to when ctx->method == 0 after vcl_pipe as finished because VRT_priv_task() could be called from director resolution. Being at it, I also noticed that our behavior in vcl_pipe {} is inconsistent as, from the shard director perspective, it is a backend method. So now, vcl_pipe {} is handled like vcl_backend_* {}. We still need to make up our mind about #3329 / #3330 and depending on the outcome we might need to touch some places again which were changed in this commit. Fixes #3361
I came across this again in the context of 3dc2bae and again stumbled over the duality of |
Yes, and you referenced this pull request, and that's when I realized I never added the conclusions from our offline discussion.
I don't see a good answer to this :-/ |
in VRT_priv_task() we asserted that only one of ctx->req and ctx->bo is set when not in vcl_pipe {}, but we also need to extend that assertion to when ctx->method == 0 after vcl_pipe as finished because VRT_priv_task() could be called from director resolution. Being at it, I also noticed that our behavior in vcl_pipe {} is inconsistent as, from the shard director perspective, it is a backend method. So now, vcl_pipe {} is handled like vcl_backend_* {}. We still need to make up our mind about varnishcache#3329 / varnishcache#3330 and depending on the outcome we might need to touch some places again which were changed in this commit. Fixes varnishcache#3361 Conflicts: doc/changes.rst lib/libvmod_directors/vmod.vcc lib/libvmod_directors/vmod_shard.c
in VRT_priv_task() we asserted that only one of ctx->req and ctx->bo is set when not in vcl_pipe {}, but we also need to extend that assertion to when ctx->method == 0 after vcl_pipe as finished because VRT_priv_task() could be called from director resolution. Being at it, I also noticed that our behavior in vcl_pipe {} is inconsistent as, from the shard director perspective, it is a backend method. So now, vcl_pipe {} is handled like vcl_backend_* {}. We still need to make up our mind about varnishcache#3329 / varnishcache#3330 and depending on the outcome we might need to touch some places again which were changed in this commit. Fixes varnishcache#3361 Conflicts: doc/changes.rst lib/libvmod_directors/vmod.vcc lib/libvmod_directors/vmod_shard.c
in VRT_priv_task() we asserted that only one of ctx->req and ctx->bo is set when not in vcl_pipe {}, but we also need to extend that assertion to when ctx->method == 0 after vcl_pipe as finished because VRT_priv_task() could be called from director resolution. Being at it, I also noticed that our behavior in vcl_pipe {} is inconsistent as, from the shard director perspective, it is a backend method. So now, vcl_pipe {} is handled like vcl_backend_* {}. We still need to make up our mind about #3329 / #3330 and depending on the outcome we might need to touch some places again which were changed in this commit. Fixes #3361 Conflicts: doc/changes.rst lib/libvmod_directors/vmod.vcc lib/libvmod_directors/vmod_shard.c
in VRT_priv_task() we asserted that only one of ctx->req and ctx->bo is set when not in vcl_pipe {}, but we also need to extend that assertion to when ctx->method == 0 after vcl_pipe as finished because VRT_priv_task() could be called from director resolution. Being at it, I also noticed that our behavior in vcl_pipe {} is inconsistent as, from the shard director perspective, it is a backend method. So now, vcl_pipe {} is handled like vcl_backend_* {}. We still need to make up our mind about varnishcache#3329 / varnishcache#3330 and depending on the outcome we might need to touch some places again which were changed in this commit. Fixes varnishcache#3361 Conflicts: doc/changes.rst lib/libvmod_directors/vmod.vcc lib/libvmod_directors/vmod_shard.c
In vcl_pipe req is read-only and we operate bereq as a busy object, as a
result we use the busy object's workspace to back VCL expressions. When
we use the synth transition we may build a reason field on the wrong
workspace since vcl_synth carries on in a client context.
It is possible to notice that the reason string belongs to the backend
workspace and make a copy inside the client workspace before the former
is released.
Fixes #3329