r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!Cheyenne] Discussions about the Cheyenne Web Server

Dockimbel
17-Apr-2011
[9688x2]
yes
Ok, let's have a look at your log files proposition...
Maxim
17-Apr-2011
[9690x2]
Doc, thanks... had only the service/process-queue... added the process-next-job() 
function and calls... 

seems like I'm getting an error elsewhere now (later in the reply 
chain), so that's a good sign.  thanks.
it would be nice to have a little options in the cfg file... something 
like

-trace-log %/path/to/folder/
Dockimbel
17-Apr-2011
[9692x2]
Max: wait...process-next-job is RSP specific (RSP requests queue 
management)
What is the issue with having %trace.log in the same folder?
Maxim
17-Apr-2011
[9694x2]
well, it took me a month to realize where it was.... in my REBOL.exe 
folder.   :-)


the problem with using "current-dir" is that it can be anywhere, 
especially on windows where the concept of a current-dir is pretty 
clueless.
just for example, depending on how you start a rebol application 
(shell, drop icon, link), there can be 3 different current dirs...
Dockimbel
17-Apr-2011
[9696]
You can change that easily if you're running it from a shortcut icon. 
Edit shortcut properties and set the "working folder" where you like 
it to be.
Maxim
17-Apr-2011
[9697x3]
yeah, but I want that kind of thing to live within the configs... 
 since... its a configuration  ;-)
anyhow.. I can hack it in quite easily... its not that big a deal.. 
just a suggestion  :-)
wrt handler... yes.. I just looked in more detai and the error is 
related to the process-next-job().
Dockimbel
17-Apr-2011
[9700]
I won't make a per log file configuration option, that wouldn't make 
much sense. When I'll had such option, it will redirect all log files 
to the same folder. Still need to finish reading onetom proposition 
to see if there's a better solution.
onetom
17-Apr-2011
[9701x2]
it should also go to a %log/ folder
meanwhile i wrote a little script to fixup the cgi hash-bang lines 
and give exec flag on them
Maxim
17-Apr-2011
[9703]
Doc,    wrt handler.. it really was a stupid error on my part... 
I didn't set the   req/out/code   so I guess it stays in limbo in 
its worker handling, since its not valid for request handling, but 
it has no return error code for reply handling either...
Dockimbel
17-Apr-2011
[9704x2]
CGI scripts run from Cheyenne don't require the executable flag to 
be set.
Cheyenne extracts the shebang line and CALL it, passing the script 
name as argument.
onetom
17-Apr-2011
[9706]
even on unix?
Dockimbel
17-Apr-2011
[9707x2]
Yes, all CGI scripts are running on my Linux box, with 644 permissions.
Max: req/out/code is used by HTTPd.r service to know if the request 
is ready or not to be sent back ;-)
Maxim
17-Apr-2011
[9709]
yeah, I figured it out by re-reading the rsp and action mods.
Dockimbel
17-Apr-2011
[9710]
So, not only it stays in limbo, but it also blocks other requests 
that might be in the pipe coming through the same HTTP connection.
Maxim
17-Apr-2011
[9711]
ah ok.
Dockimbel
17-Apr-2011
[9712x2]
onetom: even the Perl CGI scripts from %Cheyenne/perl/ are running 
OK without +x flag on my Linux.
(I just need to adapt the shebang line for Linux thought, the one 
in the archive is for Windows)
Maxim
17-Apr-2011
[9714]
If I have a single wish, it would be for all of the mods and handler 
scripts to have a verbose rebol header.  it would help a lot understanding 
the hierarchy and purpose of some of the mods.
Dockimbel
17-Apr-2011
[9715]
I agree about the headers: REBOL [ ] is a bit short. :-)
onetom
17-Apr-2011
[9716]
well, the path still should be correct, right?
Maxim
17-Apr-2011
[9717]
there are so many layers and un-obvious dependencies ( and little 
details like the error code return on top of it ) in the structure 
of the server that it gets really
Dockimbel
17-Apr-2011
[9718]
onetom: yes the path in the shebang line usually needs to be adapted 
for each local configuration.
onetom
17-Apr-2011
[9719]
Maxim: please throw together a blog entry at least about your rambles, 
so later we can use it to extend the documentation
Dockimbel
17-Apr-2011
[9720x3]
Mods hierarchy: there's no such relation between modules, it is more 
an event matrix as described here: http://cheyenne-server.org/blog.rsp?view=25
(slide 5)
Priorities are fixed per-mod and/or per-callback.
Running Cheyenne with -vvvvv (should be enough) will give you a view 
of the matrix (line by line, per event) when Cheyenne starts.
onetom
17-Apr-2011
[9723x2]
Dockimbel: I have to thank you for your presentation. Just saw it 
yesterday finally. Now I understand Cheyenne a bit more. Im curious 
about the tricky parts though. Like how do u handle forking and the 
communication between the master and the forks and stuff like that. 
I know it's handled by UniServe
Just hinting what should you write and talk about the next time; 
not asking for explanation now, of course :)
Dockimbel
17-Apr-2011
[9725x2]
Forking is done when Cheyenne starts, more precisely when the task-master 
service is loaded by UniServe. It starts with a default of 4 workers 
processes. If more than 4 simultaneous RSP or CGI requests are received, 
one or several workers are forked (up to 8). You can change those 
values in %cheyenne.r (search for pool-start and pool-max). It is 
planned to expose those values in the config file for easier access.
Oh, well, you got a quick explanation right now. :-)
Maxim
17-Apr-2011
[9727]
Doc yeah... I'm starting to be pretty knowledged on the phases (though 
some things still elude me a bit).


I'm just saying that some mods... like extapp, expire, action, alias, 
internal, etc...  probably have non-negligible effects in the chain 
that some other modules might react to or not (depending).  and its 
currently quite tricky to understand what effects the mods actually 
have on requests and response.


anyhow, as usual, Its not critique its just observation from someone 
"outside the box"   :-)
Dockimbel
17-Apr-2011
[9728x2]
Communications with the workers are handled by the task-master UniServe 
service. It is done with a TCP channel (Cheyenne/UniServe process 
is the server, workers act as clients). When a worker is launched, 
the first thing it does is to connect to the server and wait for 
a new job. If the TCP connection is lost, the server considers the 
worker dead and forks a new one to replace it. Workers are doing 
their best to maintain this (umbilical) link open, if they encounter 
a fatal error, they severe the link before quitting.
Max: no problem, I have my own critics about the way mod interact, 
the current system is powerful, but can sometimes be hard to follow 
for mod's developers (including me). When I'll work on Cheyenne v2 
(probably coded in Red), I'll redesign that system to make it more 
simple for developers.
onetom
17-Apr-2011
[9730x2]
aaah, okay, thanks, so that's why there are so many tcp ports... 
i thought those r just for debugging the workers during operation
(which also lack an example, i guess. but let's focus on this logfile 
issue now :)
Dockimbel
17-Apr-2011
[9732x2]
Several ports: Cheyenne is using several other listening ports for 
additional internal services:
- task-master: 9799 (worker process management)
- RConsole: 9801 (local debug remote console)
- logger service: 9802 (centralize all worker logs writings)
- MTA: 9803 (Cheyenne's own Mail Transfer Agent)
That's why, when started multiple times or when one of these default 
listen port is already taken, Cheyenne translates the service(s) 
on other free ports.
onetom
17-Apr-2011
[9734]
oh, that's important to know, because my plan to have the users run 
their own cheyennes might have problems
Dockimbel
17-Apr-2011
[9735]
Max:"its currently quite tricky to understand what effects the mods 
actually have on requests and response"


Agreed, some mods, like mod-static or mod-action are catching a lot 
of events and doing important things. The only way to not get lost 
is to treat it horizontally (from the slide), it means see list all 
mods catching a given event, see the process order and the exiting 
condition: 
- none: not processed

- false: processed but let other lower priority mods callback catch 
it too

- true: processed and stopping the event propagation to lower priority 
mods callback
onetom
17-Apr-2011
[9736x2]
btw, these lots of ports might look scary for the usual paranoid 
sysadmin, so it's not a good selling point. by default these all 
should be closed, but only port 80 or 8080 or something like that 
should be open
Dockimbel: you r actually writing an awesome documentation rightnow. 
if i can get access to the wiki, i would quote these on a sandbox 
page, so later we can massage it into an actual documentation