|Newbie questions about Pliant
pliant starving server
too many fullpliant processes are running.
pliant server responds very slowly
|Message posted by maybe Boris Reitman on 2006/12/01 05:04:52
|Hubert, I remember you mentioned that there is a problem with fullpliant
not cleaning up its threads/processes. Can you remind me what are the details on it.
I think I am experiencing precisely that because of some bots requesting too
many pages. Can you suggest work arounds ? Can I restart the server without
actually killing the main (parent) process ? I triend the shutdown:fast-restart
button in "server status" but that killed the main process.
|Message posted by maybe Boris Reitman on 2006/12/01 06:42:17
|looks like it is related to "execute" call dieing. I removed the execute call
in my code, and its doesn't seem to happen anymore. One curious thing is
that when I pressed Control-C to kill fullpliant, there still was one fullpliant
process running (it wasn't picked up by the killed parent).
|Message posted by maybe Hubert Tonneau on 2006/12/01 10:53:57
|I already noticed 'tar' to end as a zombie when I call it through 'execute'
but since I never had any application heavily calling "execute', it did not
Do you mean that your server is starving because too many zombies ?
You should check the 'status' 'processing' page un your running server to see
if you have more and more threads running.
and 'status' 'memory' page to see if you have more and more memory consumed.
|Message posted by maybe Boris Reitman on 2006/12/01 14:43:15
These are not zombies, these are runnning threads.
I don't think that they are [defunct] fullpliant processes, because that is not
seen in ps. Here is the output of ps aux | grep pliant:
I wasn't able to get into status page, because the server responded too slowly,
and I didn't have the patience to wait. Well, it would say that there are a lot
of threads. Not sure about memory usage.
So the problem appears to repeat even with the bad execute call removed.
Something strange is going on with the way bots where running througth my site.
I have something called "flower_database" into which i have a flower_id as a key.
Somehow I am getting null key (empty string) when the bots are running through
my site. They are probably requesting some pages without correct CGI
state/arguments. This might throw off the code, but I do not know how.
This is the first time I have noticed this kind of error, and also the first time that
I have seen so many fullpliant processes killing the system. So its probably related.
|Message posted by maybe Hubert Tonneau on 2006/12/01 20:50:45
|You must use the HTTP server status page to see what various Pliant threads
Where the is something like this in the source code:
part some_part "some comment"
then while Pliant is executing the body, any view about the processing status
of Pliant will display the comment.
This is very usefull to know that a loading production server is doing.
|Message posted by maybe Boris Reitman on 2007/01/08 00:52:37
|I was able to capture a load report soon before the server killed
itself with "exception Killed" with no call stack trace. This is a the report,
The code for virtual_tree page is here:
When I used to have only goto_url in the virtual page I didn't observe the "exception Killed"
exit of pliant. There seem to be two problems here. One is old one: when I have too many pliant threads,
and a new one: related to virtual_tree.page.
The virtual_tree.page: I converted some of the goto_url statements to execute_dynamic_page,
and when I started to observe problems with "exception 2" exit of pliant, I replaced execute_dynamic_page
with a call to page method (show_item_details and show_flowers_catalog) but that didn't seem to help.
When I get "exception Killed" exit of pliant, I have one fullpliant process left,
wich is in some broken state, and I have to kill it by hand, before
starting /pliant/fullpliant again.
Is this error because I am accessing some null pointer, or something else invalid memory access related?
How do you suggest I can debug it further. One of the symptoms that something funny
is going on is that I get this error/warning from my own code:
ERROR: no record in flower_database for
after "for " there supposed to be an id of a flower item, that is originally
passed through a CGI argument. However I am checking CGI arguments early in my handlers,
and there should be no such error. I can't reproduce it myself, by clicking around in a browser.
This must be happenning when I get crawled by web-robots. They could have been setting CGI arguments wrong.
For example in my apache log file I see url like this:
(But, I never publish my urls in this form, I always use %20 and %22 to escape the quotes.)
Perhaps its the escaped quotes that confuse it.
How can I dump a call stack trace at the point that print the error that there is no id in flower_database ?
Anyway, to sum up, I could use some help to how to handle this problem.
|Message posted by maybe Hubert Tonneau on 2007/01/08 03:56:42
|Stack overflow (infinit recursion) is the most frequent reason for Pliant to
crash ungracefully (with no usable error message).
You can start though adding a 'console' instruction in your virtual to see
how much it is called.
|Message posted by maybe Boris on 2007/01/12 22:04:50
|I am debugging with console statements, and the errors seem to repeat itself event
when in the virtual page I am only using goto_urls and not generating pages.
It looks like I access a datastructure that I haven't initialized.
This could be caused by my mistake in the code, but maybe also it could be caused by the fact that pliant
reuses variables on the stack for optimization.
If I can't dump stack trace as a print statement,
can I force an exit with a dump stack trace at a certain point in the code ?
|Message posted by maybe Hubert Tonneau on 2007/01/12 22:18:13
|> can I force an exit with a dump stack trace at a certain point in the code ?
Yes, use 'error' instruction.
You can also call 'memory_checkup' because in an efficient language,
a hard to find bug is very often the result of corrupted memory.
And finaly, you can try to run at debugging level 2.
|Message posted by maybe Boris Reitman on 2007/02/09 22:47:48
|Still having the same problems.
I tried starting the http server in debug2 mode, and this is the error I got:
actions stack is:
gather Linux kernel statistics
processor stack content is:
error_notify (ErrorID Address Str) +81
error /pliant/language/debug/error1.pli (internals) 62 1
pliant check /pliant/language/debug/check.pli (internals) 20 1 /pliant/language/deb
ug/check.pli (internals) 24 5
id Int 11
cond Int 0
cast_uInt_Int /pliant/language/type/number/int.pli (internals) 44 1 /pliant/languag
e/type/number/int.pli (internals) 47 3
j Int 49
i Int -433845296
. from string /pliant/language/type/number/int.pli (internals) 743 1 /pliant/langua
ge/type/number/int.pli (internals) 754 35
skiped (Pointer Int)
may_skip Int 0
offset (Pointer Int)
data2 uInt 386112200
i Int 9
status Int -1075839532
c Int 49
c0 Int 51
data (Pointer uInt)
stop Int 0
. from_string /pliant/language/type/text/str.pli (internals) 573 1 /pliant/language
/type/text/str.pli (internals) 577 7
ok Int 1
offset Int 1
string Str "3861122001 56106880 0 0 0 0 0 0"
skiped Int 0
pick_net_marks /pliant/linux/kernel/statistics.pli (internals) 32 3 /pliant/linux/k
ernel/statistics.pli (internals) 37 10
t_bytes uInt 386112200
r_compressed uInt 0
t_carrier uInt 0
t_fifo uInt 0
t_err uInt 0
t_colls uInt 0
r_packets uInt 42781648
r_bytes uInt 424569030
t_drop uInt 0
r_fifo uInt 0
r_drop uInt 0
r_err uInt 0
r_multicast uInt 0
r_frame uInt 0
empty_dictionary (Dictionary Str uInt)
t_compressed uInt 0
t_packets uInt 18131360
device Str "eth2
frozen expression at /pliant/linux/kernel/statistics.pli (internals) 120 1 /pliant/linux/kernel/statistics.pli (internals) 120 1 /pliant/linux/kernel/statistics.pli (internals) 120 7
lap Int -1075839376
empty_dict (Dictionary Str Intn)
empty_list (List KernelStatRecord)
execute1 /pliant/language/schedule/daemon.pli (internals) 35 1 /pliant/language/schedule/daemon.pli (internals) 41 5
run_thread /pliant/language/schedule/threads_engine.pli (internals) 328 5 /pliant/language/schedule/threads_engine.pli (internals) 368 9
cth (Pointer ThreadHeader)
success Int 134576532
h (Pointer ThreadHeader)
pid Int 313
. code_offset (FunctionExternal) +5
|Message posted by maybe Boris Reitman on 2007/02/10 03:12:29
|I rebooted the computer. I haven't tried running again at debug 2, but with a
normal run seems to work ok for about half an hour already. Maybe the computer
was in a bad state, or maybe the bots stopped doing weird requests.
The number of pliant threads is now 12 and stable.
Last two days when site worked fine the number of threads was 15 and stable.
When I started to have problems the number of threads is above 25. Requesting
a simple page starts to take a long time. Killing parent pliant leaves a child
process not killed.
|Message posted by maybe Boris Reitman on 2007/02/10 03:46:28
|sorry, its back again. the restart didn't fix it, afterall.
|Message posted by maybe Hubert Tonneau on 2007/02/10 10:35:38
|> I tried starting the http server in debug2 mode, and this is the error I got:
Oops: this raised a tiny Pliant bug that showed up at debugging level 2.
Also it does not explain your problem when running at standard debugging level 1.
When running at debugging level 1, you should go to Pliant status page while
the server is running to see how many threads have been created, how much
memory is consomed, how loaded the machine is, etc.
|Message posted by maybe Boris Reitman on 2007/02/10 14:36:04
|I am going to that page, but I don't see anything suspicious there.
Can you please fix that bug so that I can run in debugging mode 2 to detect the
location of a thread crash ?
|Message posted by maybe Hubert Tonneau on 2007/02/10 15:08:32
|In module /pliant/language/type/number/int.pli at line 743, you have to change
10*data + c-"0":0:number
10.*.data .+. (cast c-"0":0:number Int)
|Message posted by maybe Hubert Tonneau on 2007/02/10 15:09:57
|Sorry, I did it wrong again :-(
In module /pliant/language/type/number/int.pli at line 743, you have to change
10*data + c-"0":0:number
10.*.data .+. (cast c-"0":0:number uInt)
|Message posted by maybe Boris Reitman on 2007/06/25 18:07:08
|I tried running in debug2, and it looks like pliant wasn't able to read
my server configuration, as if it doesn't have permissions to
/pliant_data and /pliant_security folders. I ran it like this:
/pliant/binary/pliant-debug2.exe 'precompile /binary/http.dump module /pliant/install/minimal.pli module /pliant/protocol/http/style/default.style module /sites/broadwayflorists/precompile.pli' module /pliant/protocol/http/server.pli command 'http_server port 8080'
works fine under debug1
Also, I tried renaming /pliant/fullpliant to link to debug2.exe and run /pliant/fullpliant
but it printed some strange traces right from the start, and I don't know if it got stuck
or was compiling.