Share

bk2site

Tracker: Bugs

6 urllog isn't processed (error: chunk is already free) - ID: 1116741
Last Update: Comment added ( jmvidal )

Hi,

FreeBSD warns if a program frees memory which it
already freed. It is also able to throw a core in this
case. Here's the output of gdb from such a core:
---snip---
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public
License, and you are
welcome to change it and/or distribute copies of it
under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show
warranty" for details.
This GDB was configured as "i386-marcel-freebsd"...
Core was generated by `bk2site'.
Program terminated with signal 6, Aborted.
Reading symbols from /usr/lib/libstdc++.so.4...done.
Loaded symbols for /usr/lib/libstdc++.so.4
Reading symbols from /lib/libm.so.3...done.
Loaded symbols for /lib/libm.so.3
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /libexec/ld-elf.so.1...done.
Loaded symbols for /libexec/ld-elf.so.1
#0 0x281cb4df in kill () from /lib/libc.so.6
(gdb) bt
#0 0x281cb4df in kill () from /lib/libc.so.6
#1 0x281c1bf1 in raise () from /lib/libc.so.6
#2 0x282296ab in abort () from /lib/libc.so.6
#3 0x281de8b4 in _UTF8_wcsnrtombs () from /lib/libc.so.6
#4 0x281de8f1 in _UTF8_wcsnrtombs () from /lib/libc.so.6
#5 0x281df5fa in _UTF8_wcsnrtombs () from /lib/libc.so.6
#6 0x28150220 in operator delete () from
/usr/lib/libstdc++.so.4
#7 0x2810f17f in std::string::_Rep::_M_destroy () from
/usr/lib/libstdc++.so.4
#8 0x2810f377 in std::basic_string<char,
std::char_traits<char>, std::allocator<char>
>::~basic_string () from /usr/lib/libstdc++.so.4
#9 0x080673c4 in reference::sendAsHTML
(this=0x81ed000, templ=@0x81e8c04,
varValues=0xbfbfe508) at new_allocator.h:69
#10 0x080745d8 in element::sendAsHTML (this=0x81e8c00,
refs=@0x80a7020,
varValues=0xbfbfe508) at basic_string.h:689
#11 0x080760b1 in fileView::sendAsHTML
(this=0xbfbfdbd8, contents=@0x80a7020,
allReferences=@0xbfbfdc18, newsItems=@0xbfbfdbf8,
varValues=0xbfbfe508,
channels=@0xbfbfe498) at element.C:261
#12 0x0805cc85 in referenceTree::createSiteH
(this=0x80a7020,
varValues=0xbfbfe508, allReferences=@0xbfbfdc18,
channels=@0xbfbfe498,
baseView=@0xbfbfdbd8, otherView=@0xbfbfdbb8,
newsItems=@0xbfbfdbf8,
depth=0, navigateBar=
{static npos = 4294967295, _M_dataplus =
{<std::allocator<char>> =
{<__gnu_cxx::new_allocator<char>> = {<No data fields>},
<No data fields>}, _M_p = 0x80a4f54 ""}}, parentTitle=
{static npos = 4294967295, _M_dataplus =
{<std::allocator<char>> =
{<__gnu_cxx::new_allocator<char>> = {<No data fields>},
<No data fields>}, _M_p = 0x80b802c "Directory
index"}}, folderTitle=
{static npos = 4294967295, _M_dataplus =
{<std::allocator<char>> =
{<__gnu_cxx::new_allocator<char>> = {<No data fields>},
<No data fields>}, _M_p = 0x8---Type <return> to
continue, or q <return> to quit---
0a4f54 ""}}, filePath=
{static npos = 4294967295, _M_dataplus =
{<std::allocator<char>> =
{<__gnu_cxx::new_allocator<char>> = {<No data fields>},
<No data fields>}, _M_p = 0x80a4f54 ""}}) at
basic_string.h:422
#13 0x08061263 in referenceTree::createSite
(this=0x80a7020,
varValues=0xbfbfe508, channels=@0xbfbfe498) at
new_allocator.h:62
#14 0x0804ea36 in main (argc=3, argv=0xbfbfe5ac) at
bk2site.C:497
(gdb) list
497 myrt->createSite(varValues,
channels);
498
499 for (unsigned int ne = 0; ne <
extraFileName.size(); ne++)
500
myrt->createPage(extraFileBase[ne], varValues[DESTDIR]
+ extraFileName[ne], varValues, channels);
501 }
502
503 //write out the bookmark file
504 if (varValues[OUTPUTBOOKMARKFILE] != "") {
505 ofstream
otstream(varValues[OUTPUTBOOKMARKFILE].c_str(), ios::out);
506 cout << "Opening " <<
varValues[OUTPUTBOOKMARKFILE] << " for writing" << endl;
---snip---

If I don't let FreeBSD dump a corefile, bk2site doesn't
segfault, but the urllog file isn't processed as
intended. Even when there are a lot of entries in the
logfile, no URL get's marked as visited in the output
files. The urllog file is empty after bk2site finishes.

My tophits template contains this:
---snip---
<!--bk2site:begin tophits-->
<!--bk2site:top <table align=center width="100%"
border=0 cellspacing=0 cellpadd
ing=0><?php $url_modulo_counter=0; ?>
<tr bgcolor=<?php echo $table_head_color;
?>><th><font color="#ffffff">Hits</font></th><th><font
color="#ffffff">What</fo
nt></th><th>&nbsp;</th><th><font
color="#ffffff">Description</font></th></tr>
-->
<!--bk2site:bottom
</table>-->
<!--bk2site:template <tr valign=top bgcolor=<?php
$url_modulo_counter++;
if($url_modulo_counter%2)
{
echo $table_row_color_first;
} else {
echo $table_row_color_second;
}
?>><td align=right><font
color="red">%HITS</font>&nbsp;</td><td>&nbsp;<a href="/
cgi-bin/redir.pl?url=%URL">%TITLE</a>&nbsp;</td><td
align=center>&nbsp;<a href="
http://www.hotbot.com/?clickSrc=search&MT=%URL&SM=url&DC=50"><?php
insert_image(
"images/closeup.gif", "Who points to it?", "bottom");
?></a>&nbsp;&nbsp;</td><td
>%COMMENT&nbsp;</td></tr>-->
<!--bk2site:cols 1-->
<!--bk2site:maxnum 20-->
<!--bk2site:end-->
---snip---

Bye,
Alexander.


Alexander Leidinger ( aleidinger ) - 2005-02-05 09:10

6

Closed

Fixed

Jose M. Vidal

None

segmentation fault

Public


Comments ( 2 )




Date: 2005-02-28 20:09
Sender: jmvidalProject Admin

Logged In: YES
user_id=3750

I applied the patch and checked the new version to CVS.

Thanks Alexander!


Date: 2005-02-18 21:25
Sender: aleidinger

Logged In: YES
user_id=90585

Hi,

the attached patch fixes my problems. The reference.C part
fixes the chunk already free error, and the bk2site.C part
fixes the refcounting issue.

Bye,
Alexander.


Log in to comment.

Attached File ( 1 )

Filename Description Download
bk2site.diff Bugfix Download

Changes ( 6 )

Field Old Value Date By
resolution_id None 2005-02-28 20:09 jmvidal
close_date - 2005-02-28 20:09 jmvidal
status_id Open 2005-02-28 20:09 jmvidal
File Added 121826: bk2site.diff 2005-02-18 21:25 aleidinger
priority 5 2005-02-05 09:14 aleidinger
assigned_to nobody 2005-02-05 09:14 aleidinger