Hi tntnet users,
I just found a very old bug in the component loader, which may crash tntnet
under very rare circumstances. The problem was in Comploader::fetchComp, which
looks for the requested component.
The method first looks, if the component already exists. For that it requests a
read lock. When the component was not loaded already, it releases the read
lock and takes the write lock. After rechecking, if the component is really
not created it is created and put into the map of existing components. The new
component is returned. Or better - it should be returned.
The found problem was a race condition. If the component was created by
another thread after the current thread waits for the write lock, the thread
actually does the rechecking. And after it finds out, that the component was
now created, it returns a reference to the previously not found component,
which actually was invalid instead of the now successfully found component.
So the problem may happen, when 2 requests are directed to the same component
for the first time.
I fixed the bug in the svn in revision 1213.
On 9th-12th of June there is the LinuxTag in Berlin and I have a booth there.
Until then I will release a fresh new tntnet. It is really long time since the
last release but we did very large changes in cxxtools, which really needed
much testing. Since some weeks we have not found any regressions any more and
I feel finally good for a stable release. It will be labeled cxxtools 2.0.
Maybe I should label tntnet also as 2.0 instead of 1.7.0. Tntnet has also got
some changes. Existing tntnet applications will be source compatible, so there
won't be any need for porting.
The only possible incompatibility I know are the changes in http message
headers. They are passed and returned as const char* instead of std::string.
Setting headers won't be any problem, but this won't work as before:
if (request.getHeader("someHeader") == "header value")
since now it just compares the char*. In tntnet 1.6.3 it was actually a
std::string, which has a suitable operator== for this.
Tommi
------------------------------------------------------------------------------
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general