[ Is the #freeamp hidden? It was not on the list, but I could join
it... ]
Theme for this whole thread of discussion:
[chrisk@kuklewicz ~/www]$ fortune
Nothing endures but change.
-- Heraclitus
An update on my progress,
Yesterday I replaced how metadata is stored internally and much of how
it is accessed of outside (e.g. PeekAlbum() not Album().c_str() and
Album_length() not Album().size() and so on). Before I submit I will
temporarily disable the const string Album() style access methods and
follow the compiler errors to audit how the returned strings are used.
The strings are now *temporary* objects, instead of "const string&"
references to MetaData fields.
With help from Isaac I managed to get it compiling and it ran & loaded
the playlist just find, but editing a comment segfaulted.
I have it cleaner today, with a slightly more evolved design and it
could edit metadata okay, but opening the streams part of the tree
eventually segfaulted. It seems I did need to be thread safe. I
observed the two [New Thread xxx (runnable)] notices, and the names of
the functions in the back trace (at end of message). So I now use a
Mutex in the HashStore to protect everything. Also, thank you to
whomever already added the AutoMutex class!
I also added a static const char empty[1]=""; to the HashStore for
caching (merge duplicates) of all zero length strings. I also went
back and changes the HashStore methods to use const everywhere again.
Old example output from "cerr << *m_store" after it loaded my database
on startup:
HashStore report
Logical Strings held: 2317
Strings in HSet: 1009
Strings in HMap: 146
So very soon I will have a whopper of a patch. Any special handling
requests?
Currently: I did make clean && make, and now I sleep.
Most recent crash as seen by gdb, as evidence that thread safety is required:
@ ui/musicbrowser/unix/src/browsertree.cpp : 1370 : void GTKMusicBrowser::StreamTimer()
LWP 15638 exited.
@ ui/musicbrowser/unix/src/browsertree.cpp : 1535 : void
GTKMusicBrowser::FillRelatable(bool = false)
[New Thread 28701 (runnable)]
Delayed SIGSTOP caught for LWP 15639.
@ ui/musicbrowser/unix/src/browsertree.cpp : 1331 : static void
GTKMusicBrowser::stream_timer_func(void *)
@ lib/http/src/Http.cpp : 92 : enum Error Http::DownloadToString(const class string &,
class string &)
args: url=http://www.freeamp.org/streams.xml, page=, m_bytesInBuffer=0,
m_bufferSize=0, (void *)m_buffer=(nil)
@ lib/http/src/Http.cpp : 181 : enum Error Http::Download(const class string &, bool)
args: url=http://www.freeamp.org/streams.xml, fileDownload=0
@ lib/http/src/Http.cpp : 182 : enum Error Http::Download(const class string &, bool)
args: m_bufferSize=0, m_bytesInBuffer=0, (void*)m_buffer=(nil)
@ ui/musicbrowser/unix/src/browsertree.cpp : 1535 : void
GTKMusicBrowser::FillRelatable(bool = false)
[New Thread 29726 (runnable)]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 29726 (runnable)]
0x80d4043 in hashtable<char *, char *, hash<char *>, identity<char *>, EqualString,
__default_alloc_template<true, 0> >::erase (this=0x813aa50, it=@0xbbfffaa4)
at /usr/include/g++-2/stl_hashtable.h:777
777 node* next = cur->next;
(gdb) bt
#0 0x80d4043 in hashtable<char *, char *, hash<char *>, identity<char *>,
EqualString, __default_alloc_template<true, 0> >::erase (this=0x813aa50,
it=@0xbbfffaa4)
at /usr/include/g++-2/stl_hashtable.h:777
#1 0x80d5ddd in hashtable<char *, char *, hash<char *>, identity<char *>,
EqualString, __default_alloc_template<true, 0> >::erase (this=0x813aa50,
it=@0xbbfffacc)
at /usr/include/g++-2/stl_hashtable.h:829
#2 0x80d5da7 in hash_set<char *, hash<char *>, EqualString,
__default_alloc_template<true, 0> >::erase (this=0x813aa50, it={cur = 0x81ef448, ht =
0x813aa50})
at /usr/include/g++-2/stl_hash_set.h:160
#3 0x809ecf2 in HashStore::unref (this=0x813aa50,
s=0x81eb4a8 "\030\e\b\036@0's (Rob's Pick) ")
at base/src/charstore.cpp:204
#4 0x80e48fc in MetaData::setentry (dest=@0xbbfffcf4,
src=0x40e3b7c0 "Upbeat 80's (Rob's Pick)") at base/include/metadata.h:166
#5 0x80e4319 in MetaData::SetTitle (this=0xbbfffcec,
title=0x40e3b7c0 "Upbeat 80's (Rob's Pick)") at base/include/metadata.h:83
#6 0x4096f063 in Misc::ReadMetaData (this=0x8148ff0,
url=0x40e3b730 "http://216.32.166.94:8076/\"", metadata=0xbbfffcec)
at plm/metadata/misc/misc.cpp:227
#7 0x80b2721 in PlaylistManager::MetaDataThreadFunction (this=0x81452f8,
list=0x81e0f28) at base/src/playlist.cpp:2472
#8 0x80b292b in PlaylistManager::metadata_thread_function (arg=0x81f34f0)
at base/src/playlist.cpp:2519
---Type <return> to continue, or q <return> to quit---
#9 0x80c4b4d in pthreadThread::InternalThreadFunction (this=0x8b93788)
at base/unix/src/pthreadthread.cpp:73
#10 0x80c4b1d in pthreadThread::internalThreadFunction (arg=0x8b93788)
at base/unix/src/pthreadthread.cpp:62
#11 0x40028cd5 in pthread_start_thread (arg=0xbbfffe40) at manager.c:241
#12 0x4002969c in pthread_start_thread_event (arg=0xbbfffe40) at manager.c:264
Oh, and gdb used up way way way too many resources for my machine
during the above session:
12:29am up 17 days, 5 min, 5 users, load average: 0.27, 1.29, 0.95
105 processes: 85 sleeping, 1 running, 19 zombie, 0 stopped
CPU states: 4.0% user, 3.6% system, 0.0% nice, 92.2% idle
Mem: 79256K av, 77216K used, 2040K free, 21472K shrd, 1636K buff
Swap: 128480K av, 116904K used, 11576K free 14440K cached
PID USER PRI NI SIZE RSS SHARE STAT LIB %CPU %MEM TIME COMMAND
15578 ckuklewi 0 0 80992 20M 496 S 0 0.0 26.5 0:57 gdb
15584 ckuklewi 0 0 17660 17M 3872 S 0 0.0 22.2 0:08 freeamp
15589 ckuklewi 0 0 17660 17M 3872 S 0 0.0 22.2 0:00 freeamp
15590 ckuklewi 0 0 17660 17M 3872 S 0 0.0 22.2 0:00 freeamp
15591 ckuklewi 0 0 17660 17M 3872 S 0 0.0 22.2 0:00 freeamp
15592 ckuklewi 0 0 17660 17M 3872 S 0 0.0 22.2 0:05 freeamp
15593 ckuklewi 0 0 17660 17M 3872 S 0 0.0 22.2 0:00 freeamp
15595 ckuklewi 0 0 17660 17M 3872 S 0 0.0 22.2 0:10 freeamp
30341 root 13 0 10616 8880 1644 S 0 1.3 11.2 35:10 X
2972 ckuklewi 0 0 9056 3680 2444 S 0 0.0 4.6 8:28 emacs
30386 ckuklewi 0 0 3596 3016 2244 S 0 0.0 3.8 0:22 panel
30377 ckuklewi 0 0 2268 2032 924 S 0 0.0 2.5 0:52 sawfish
30404 ckuklewi 0 0 1964 1460 1196 S 0 0.0 1.8 0:25 tasklist_app
30423 ckuklewi 0 0 5148 1116 712 S 0 0.0 1.4 0:23 gnome-termin
_______________________________________________
[EMAIL PROTECTED]
http://www.freeamp.org/mailman/listinfo/freeamp-dev