You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rivet-dev@tcl.apache.org by Massimo Manghi <ma...@unipr.it> on 2016/03/01 14:52:02 UTC
Re: New install help
Hi
On 02/29/2016 09:23 PM, Brice Hamon wrote:
>
> Ok here is some facts:
>
> When apache is started, and Rivet gets loaded, it calls the
> RivetInitChildScript.
>
> In this script, I init all DB connections, open some TCP sockets, and
> generate a log file under /tmp. This is working. and a log file is
> created under the /tmp/xxxxxxxj/tmp/mylog and no error is thrown.
>
> Now in a vhost rivet's page, I also open the same log file than in
> the RivetInitChildScript but this time this fails with an access denied.
>
> Seems like when I am in a rivet page, I am still in a jail environment
> which in that case I should, but for some reason the /tmp from an open
> file TCL command is not chroot to the jail location.
>
> Odd no ?
>
>
Do you run rivet with SeparateVirtualInterps? It makes sense you do
otherwise there is no difference between virtual hosts from the point of
view of a Tcl interpreter. If I'm correct and you are actually running
rivet with SeparateVirtualInterps then the only difference between
virtual hosts is the Tcl interpreter is a slave of master Tcl
interpreter. I don't know if slave Tcl interpreter can be set to change
the way [open] works , but after all slave interpreter were introduced
with the purpose of having safe interpreters, so some implications might
exist.
Rivet 3.0.0 instead creates only top level Tcl interpreters for each
virtual host. Apparently you are running prefork with your server. The
module should load the prefork bridge automatically and if my hypotheses
is correct you should see something different
I recommend you check with Reinhard and ask how Tcl on SUSE is built
(especially regarding slave interpreters)
-- Massimo
---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org
Re: New install help
Posted by Massimo Manghi <mx...@apache.org>.
On 03/03/2016 06:03 AM, Brice Hamon wrote:
> I will give it a shot but after I understand something with 2.4.
>
> I now use SeparateVirtualInterps set to on and ChildInitScript to init all
> DB connections and sockets for each child processes. How do I get access to
> them from a .rvt page?
>
you get access to them by fully qualifying the names of
variables/commands that refer to them. You may store your I/O handles
and DB connections in some namespace, provided you qualify its name
*outside* the ::request namespace. Years ago I wrote this page for the
manual about request processing
http://tcl.apache.org/rivet/manual2.2/request.html
it explain the default globals namespace :: is the namespace where
script run except for code placed in rvt templates that runs within the
::request namespace. Obviously you can't store the application status in
those variables, the Session package is there for this.
> I tried ::request::global, or looking for [info vars xxx] etc but could not
> find my variables.
>
> Thanks
>
I usually do most of the work of processing a request in BeforeScript
and put in the template just the code to fetch the data to be displayed
(along with the page title and other metadata...)
-- Massimo
---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org
Re: New install help
Posted by Brice Hamon <no...@gmail.com>.
I will give it a shot but after I understand something with 2.4.
I now use SeparateVirtualInterps set to on and ChildInitScript to init all
DB connections and sockets for each child processes. How do I get access to
them from a .rvt page?
I tried ::request::global, or looking for [info vars xxx] etc but could not
find my variables.
Thanks
Re: New install help
Posted by Massimo Manghi <mx...@apache.org>.
After your clarification I don't know if 3.0.0 will solved your problem
anymore, but it's stable enough to test it, so please get it from the
repository and build it for development system.
-- Massimo
On 03/02/2016 07:48 PM, Brice Hamon wrote:
> Hi Massimo,
>
> In fact I am running rivet with SeparateVirtualInterps set to off.
>
> I init the DB connections and sockets in the ServerInitScript, and access
> global arrays and objects in rivet pages.
> So I guess this was working because I had only 1 interpreter.
>
> Now if I set the SeparateVirtualInterps to on, the open log error is not
> triggered, so the jail environment is working fine.
> But I can't access my global variables anymore. What is the best way to do
> that?
>
> Also is Rivet 3.0.0 in a stable form worth a try?
>
> Thank you,
> Brice.
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org
Re: New install help
Posted by Brice Hamon <no...@gmail.com>.
Hi Massimo,
In fact I am running rivet with SeparateVirtualInterps set to off.
I init the DB connections and sockets in the ServerInitScript, and access
global arrays and objects in rivet pages.
So I guess this was working because I had only 1 interpreter.
Now if I set the SeparateVirtualInterps to on, the open log error is not
triggered, so the jail environment is working fine.
But I can't access my global variables anymore. What is the best way to do
that?
Also is Rivet 3.0.0 in a stable form worth a try?
Thank you,
Brice.
On Tue, Mar 1, 2016 at 8:52 AM, Massimo Manghi <ma...@unipr.it>
wrote:
> Hi
>
> On 02/29/2016 09:23 PM, Brice Hamon wrote:
>
>>
>> Ok here is some facts:
>>
>> When apache is started, and Rivet gets loaded, it calls the
>> RivetInitChildScript.
>>
>> In this script, I init all DB connections, open some TCP sockets, and
>> generate a log file under /tmp. This is working. and a log file is
>> created under the /tmp/xxxxxxxj/tmp/mylog and no error is thrown.
>>
>> Now in a vhost rivet's page, I also open the same log file than in
>> the RivetInitChildScript but this time this fails with an access denied.
>>
>> Seems like when I am in a rivet page, I am still in a jail environment
>> which in that case I should, but for some reason the /tmp from an open
>> file TCL command is not chroot to the jail location.
>>
>> Odd no ?
>>
>>
>>
> Do you run rivet with SeparateVirtualInterps? It makes sense you do
> otherwise there is no difference between virtual hosts from the point of
> view of a Tcl interpreter. If I'm correct and you are actually running
> rivet with SeparateVirtualInterps then the only difference between virtual
> hosts is the Tcl interpreter is a slave of master Tcl interpreter. I don't
> know if slave Tcl interpreter can be set to change the way [open] works ,
> but after all slave interpreter were introduced with the purpose of having
> safe interpreters, so some implications might exist.
>
> Rivet 3.0.0 instead creates only top level Tcl interpreters for each
> virtual host. Apparently you are running prefork with your server. The
> module should load the prefork bridge automatically and if my hypotheses is
> correct you should see something different
>
> I recommend you check with Reinhard and ask how Tcl on SUSE is built
> (especially regarding slave interpreters)
>
> -- Massimo
>