Hi David,
tricky thing: naviserver collects in its blueprint all defined namepaces.
With Tcl 8.5, several built-in commands went from C to scripted Tcl,
such as the implementation of clock. Tcl uses the ::tcl namespace
for that. It seems, as if the blueprint of Tcl (including ::tcl::* variables
and commands) messes up initialization of the ::clock command.
The easiest fix is not to include the stuff from the ::tcl namespace
in the blueprint, since Tcl takes care about this during initialization.
The fix is quite simple:
https://bitbucket.org/naviserver/naviserver/commits/a91fe6050ddba5ae5b42222f6c0dbc36acc004b2
you should be able to simply add that line to your 4.99.5 installation.
All the best
-gustaf neumann
Am 04.07.13 18:06, schrieb David Osborne:
Hi,
Wondering if you can help us understand what's happening here.
(Currently testing under naviserver 4.99.5 with Tcl 8.5.11)
Our test case is the following proc:
proc clock_test {} {
log Notice [clock format [clock scan now] -format "%Y-%m-%d
%H:%M:%S" -timezone :Tcl/Localtime]
return true
}
If we open a naviserver control port and run the command it works:
> ns_schedule_proc -once 0 clock_test
[04/Jul/2013:16:17:49][2278.7f08c0bf5700][-sched-] Notice: 2013-07-04
16:37:49
However, if we now run any ns_eval and repeat, the clock command will
fail:
> ns_eval expr {2+1}
3
> ns_schedule_proc -once 0 clock_test
[04/Jul/2013:16:25:17][2278.7f08c0b73700][-sched-] Error: time zone
":Tcl/Localtime" not found
We can see why this is failing. It's because, after the ns_eval,
namespace eval clock is called from Tcl's init script. This means the
next call to the clock ensemble will run clock::Initialize again. This
resets the TZData array (removing :Tcl:Localtime) but :Tcl/Localtime
is still cached in the ::tcl::clock::CachedSystemTimeZone variable...
hence the error.
If we now run the proc in its own thread, it will work again until
another ns_eval is performed.
> ns_schedule_proc -once -thread 0 clock_test
[04/Jul/2013:16:46:06][18122.7f2c93f53700][-sched:7-] Notice:
2013-07-04 16:46:06
> ns_eval expr {2+2}
> ns_schedule_proc -once -thread 0 clock_test
[04/Jul/2013:16:46:15][18122.7f2c93f53700][-sched:8-] Error: time zone
":Tcl/Localtime" not found
It's a bit of a contrived test case but believe it or not, we are
encountering basically the same situation in production.
If ::tcl::clock::ClearCaches were to be called before the second
::tcl::clock::Initialize I think everything would be fine. But would
be interested to hear opinions on why this is manifesting itself in
these situations.
Regards,
--
David
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel