aMule Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're back! (IN POG FORM)

Pages: [1] 2

Author Topic: Mac problems with mutexes  (Read 16491 times)

wuischke

  • Developer
  • Hero Member
  • *****
  • Karma: 183
  • Offline Offline
  • Posts: 4292
Mac problems with mutexes
« on: January 09, 2009, 04:28:43 PM »

Quote
Error: Could not unlock mutex (error 0: Unknown error: 0)
This sounds bad. Stu, do you have any clue what might causing it?
« Last Edit: January 10, 2009, 01:37:52 PM by wuischke »
Logged

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3739
  • Engines screaming
Re: Can't connect to server or KAD with 2.2.3. Could anybody help me?
« Reply #1 on: January 09, 2009, 05:39:03 PM »

No.  :(
But I notice we have a lot of Mac problems lately (and Mac only). I wonder if just a lot of Mac users started using aMule, or if there's a real problem. However, I don't have a clue about Macs...
Logged
The image of mother goddess, lying dormant in the eyes of the dead, the sheaf of the corn is broken, end the harvest, throw the dead on the pyre -- Iron Maiden, Isle of Avalon

gtoso

  • Official MacOSX Packager
  • Full Member
  • ***
  • Karma: 24
  • Offline Offline
  • Posts: 206
Re: Can't connect to server or KAD with 2.2.3. Could anybody help me?
« Reply #2 on: January 09, 2009, 07:10:58 PM »

mutex errors are "normal": I saw them from long time.
A new problem is ipfilter.dat, but even 2.2.2, which before worked, has the same problem, so I thinked that file format was changed on emulepawcio, I have not investigated.

Startup messages on Tiger with version check and ipfilter update enabled:

Code: [Select]
super:~ gtoso$ /Applications/aMule-SVN/aMule.app/Contents/MacOS/amule
Initialising aMule 2.2.3 using wxMac v2.8.9
Checking if there is an instance already running...
No other instances are running.
HTTP download thread started
ListenSocket: Ok.
Host: amule.sourceforge.net:80
URL: http://amule.sourceforge.net/lastversion
Response: 0 (Error: 3)
WARNING: Void response on stream creation
HTTP download thread ended
Loading temp files from /Volumes/Mastro/Mulo/Temp.

All PartFiles Loaded.
No shareable files found in directory: /Volumes/Mastro/Mulo/aMule Downloads
HTTP download thread started
Error: Could not unlock mutex (error 1: Operation not permitted)
Error: Could not unlock mutex (error 0: Unknown error: 0)
Host: emulepawcio.sourceforge.net:80
URL: http://emulepawcio.sourceforge.net/ipfilter.dat
Response: 302 (Error: 0)
Host: downloads.sourceforge.net:80
URL: http://downloads.sourceforge.net/emulepawcio/ipfilter.dat?use_mirror=
Response: 302 (Error: 0)
Host: surfnet.dl.sourceforge.net:80
URL: http://surfnet.dl.sourceforge.net/sourceforge/emulepawcio/ipfilter.dat
Response: 200 (Error: 0)
Download size: 22330388
HTTP download thread ended
Shutting down aMule...
aMule dialog destroyed
Now, exiting main app...
Killing amuleweb instance with pid `10636' ... Killed!
aMule OnExit: Terminating core.
aMule shutdown completed.
super:~ gtoso$

Corresponding log:
Code: [Select]
super:~ gtoso$ cat Library/Application\ Support/aMule/logfile
2009-01-09 19:03:49: Starting aMule 2.2.3 using wxMac v2.8.9
2009-01-09 19:03:54: Il file dei crediti è stato caricato, 4707 client conosciuti
2009-01-09 19:03:55: Carico i filtri IP da 'ipfilter.dat' e 'ipfilter_static.dat'.
2009-01-09 19:03:55: Impossibile caricare il file ipfilter.dat '/Users/gtoso/Library/Application Support/aMule/ipfilter.dat', trovato formato sconosciuto.
2009-01-09 19:03:55: Caricati 0 intervalli di IP da '/Users/gtoso/Library/Application Support/aMule/ipfilter_static.dat'. 0 righe non valide sono state scartate.
2009-01-09 19:03:55: *** TCP socket (ECServer) listening on 0.0.0.0:4712
2009-01-09 19:03:55: Created Server UDP-Socket at port 4665
2009-01-09 19:03:55: Created Client UDP-Socket at port 4672
2009-01-09 19:04:06: Invalid response from http download server
2009-01-09 19:04:06:
2009-01-09 19:04:06:  - Questo è aMule 2.2.3 using wxMac v2.8.9 basato su eMule.
2009-01-09 19:04:06:    In esecuzione su Mac OS X (Darwin 8.11.0 Power Macintosh)
2009-01-09 19:04:06:  - Visita http://www.amule.org per sapere se è disponibile una nuova versione.
2009-01-09 19:04:06:
2009-01-09 19:04:06: Caricati 248 flag bitmap.
2009-01-09 19:04:09: Caricamento file server.met: /Users/gtoso/Library/Application Support/aMule/server.met
2009-01-09 19:04:09: Trovati 9 server nel file server.met
2009-01-09 19:04:09: Non è stato trovato alcun file incompleto
2009-01-09 19:04:09: Trovati 65 file condivisi conosciuti
2009-01-09 19:04:10: Connessione in corso
2009-01-09 19:04:10: Connessione a eDonkeyServer No2 (212.63.206.35 - 212.63.206.35:4242)
2009-01-09 19:04:13: Letti 184 contatti Kad
2009-01-09 19:04:14: web server in esecuzione su pid 10636
2009-01-09 19:04:15: ThreadScheduler: Completed task 'AICH Syncronizing', 0 tasks remaining.
2009-01-09 19:04:15: Impossibile scaricare il file per il controllo della versione
2009-01-09 19:04:15: Connessione a Sharing Kingdom 2 (89.248.172.50 - 89.248.172.50:4500)
2009-01-09 19:04:15: Connessione a eDonkeyServer No2 (212.63.206.35:4242) non riuscita per time-out.
2009-01-09 19:04:15: Connessione a Sharing Kingdom 4 (89.248.172.90 - 89.248.172.90:4500)
2009-01-09 19:04:15: Connesso a Sharing Kingdom 4 (89.248.172.90:4500)
2009-01-09 19:04:17: Kad avviato.
2009-01-09 19:04:17: Persa connessione a Sharing Kingdom 4 (89.248.172.90:4500)
2009-01-09 19:04:17: Connessione persa
2009-01-09 19:04:18: Accettata nuova connessione esterna
2009-01-09 19:04:18: Connessione a PEERATES.NET (88.191.81.111 - 88.191.81.111:1111)
2009-01-09 19:04:18: Connessione al client: aMuleweb 2.2.3
2009-01-09 19:04:18: Accesso consentito.
2009-01-09 19:04:18: Connesso a PEERATES.NET (88.191.81.111:1111)
2009-01-09 19:04:18: Connesso a Sharing Kingdom 2 (89.248.172.50:4500)
2009-01-09 19:04:19: Persa connessione a PEERATES.NET (88.191.81.111:1111)
2009-01-09 19:04:19: Connessione persa
2009-01-09 19:04:19: Persa connessione a Sharing Kingdom 2 (89.248.172.50:4500)
2009-01-09 19:04:19: Connessione persa
2009-01-09 19:04:33: Kad arrestato.
2009-01-09 19:04:33: Connesso alla rete Kad (firewalled)
2009-01-09 19:04:41: Connessione a Sharing Kingdom 4 (89.248.172.90:4500) non riuscita per time-out.
2009-01-09 19:04:41: Connessione a Sharing Kingdom 1 (89.248.172.54 - 89.248.172.54:4500)
2009-01-09 19:04:43: Connesso a Sharing Kingdom 1 (89.248.172.54:4500)
2009-01-09 19:04:43: Connessione a PEERATES.NET (88.191.81.111:1111) non riuscita per time-out.
2009-01-09 19:04:43: Connessione a Sharing Kingdom 3 (89.248.172.86 - 89.248.172.86:4500)
2009-01-09 19:04:44: Connesso a Sharing Kingdom 3 (89.248.172.86:4500)
2009-01-09 19:04:57: Connessione stabilita con: Sharing Kingdom 1
2009-01-09 19:05:01: Connesso a Sharing Kingdom 1 con ID alto
2009-01-09 19:05:02: Il nuovo clientID è 109132695
2009-01-09 19:05:02: Messaggio del server: server version 17.15 (lugdunum)
2009-01-09 19:05:02: Messaggio del server: ÔªøGRATUITA  www.StormSex.net  VIDEO E FOTO XXX: Le piu' belle ragazze d'europa si esibiscono per voi !!! www.StormSex.net GRATUITA
2009-01-09 19:05:02: Messaggio del server: GRATUITA  www.StormSex.net  VIDEO E FOTO XXX: Le piu' belle ragazze d'europa si esibiscono per voi !!! www.StormSex.net GRATUITA
2009-01-09 19:05:03: Messaggio del server: GRATUITA  www.StormSex.net  VIDEO E FOTO XXX: Le piu' belle ragazze d'europa si esibiscono per voi !!! www.StormSex.net GRATUITA
2009-01-09 19:05:03: Messaggio del server: GRATUITA  www.StormSex.net  VIDEO E FOTO XXX: Le piu' belle ragazze d'europa si esibiscono per voi !!! www.StormSex.net GRATUITA ex.net
2009-01-09 19:05:13: Connesso alla rete Kad (ok)
2009-01-09 19:05:34: Carico i filtri IP da 'ipfilter.dat' e 'ipfilter_static.dat'.
2009-01-09 19:05:34: Impossibile caricare il file ipfilter.dat '/Users/gtoso/Library/Application Support/aMule/ipfilter.dat', trovato formato sconosciuto.
2009-01-09 19:05:34: Caricati 0 intervalli di IP da '/Users/gtoso/Library/Application Support/aMule/ipfilter_static.dat'. 0 righe non valide sono state scartate.
2009-01-09 19:07:22: Scritti 174 contatti Kad
2009-01-09 19:07:25: Disconnesso dalla rete eD2k
2009-01-09 19:07:25: Disconnesso dalla rete Kad
super:~ gtoso$

« Last Edit: January 09, 2009, 07:34:34 PM by gtoso »
Logged

gtoso

  • Official MacOSX Packager
  • Full Member
  • ***
  • Karma: 24
  • Offline Offline
  • Posts: 206
Re: Can't connect to server or KAD with 2.2.3. Could anybody help me?
« Reply #3 on: January 09, 2009, 07:21:52 PM »

The same, but without ipfilter download and in English:

Code: [Select]
super:~ gtoso$ /Applications/aMule-SVN/aMule.app/Contents/MacOS/amule
Initialising aMule 2.2.3 using wxMac v2.8.9
Checking if there is an instance already running...
No other instances are running.
HTTP download thread started
ListenSocket: Ok.
Host: amule.sourceforge.net:80
URL: http://amule.sourceforge.net/lastversion
Response: 0 (Error: 3)
WARNING: Void response on stream creation
HTTP download thread ended
Loading temp files from /Volumes/Mastro/Mulo/Temp.

All PartFiles Loaded.
No shareable files found in directory: /Volumes/Mastro/Mulo/aMule Downloads
Error: Could not unlock mutex (error 1: Operation not permitted)
Error: Could not unlock mutex (error 0: Unknown error: 0)
Shutting down aMule...
aMule dialog destroyed
Now, exiting main app...
Killing amuleweb instance with pid `10654' ... Killed!
aMule OnExit: Terminating core.
aMule shutdown completed.
super:~ gtoso$

Code: [Select]
super:~ gtoso$ cat Library/Application\ Support/aMule/logfile.bak 2009-01-09 19:14:31: Starting aMule 2.2.3 using wxMac v2.8.9
2009-01-09 19:14:35: Creditfile loaded, 4707 clients are known
2009-01-09 19:14:35: Loading IP-filters 'ipfilter.dat' and 'ipfilter_static.dat'.
2009-01-09 19:14:35: Failed to load ipfilter.dat file '/Users/gtoso/Library/Application Support/aMule/ipfilter.dat', unknown format encountered.
2009-01-09 19:14:35: Loaded 0 IP-ranges from '/Users/gtoso/Library/Application Support/aMule/ipfilter_static.dat'. 0 malformed lines were discarded.
2009-01-09 19:14:35: *** TCP socket (ECServer) listening on 0.0.0.0:4712
2009-01-09 19:14:35: Created Server UDP-Socket at port 4665
2009-01-09 19:14:35: Created Client UDP-Socket at port 4672
2009-01-09 19:14:40:
2009-01-09 19:14:40:  - This is aMule 2.2.3 using wxMac v2.8.9 based on eMule.
2009-01-09 19:14:40:    Running on Mac OS X (Darwin 8.11.0 Power Macintosh)
2009-01-09 19:14:40:  - Visit http://www.amule.org to check if a new version is available.
2009-01-09 19:14:40:
2009-01-09 19:14:41: Loaded 248 flag bitmaps.
2009-01-09 19:14:43: Invalid response from http download server
2009-01-09 19:14:43: Loading server.met file: /Users/gtoso/Library/Application Support/aMule/server.met
2009-01-09 19:14:43: 9 servers in server.met found
2009-01-09 19:14:43: No part files found
2009-01-09 19:14:44: Found 65 known shared files
2009-01-09 19:14:44: Connecting
2009-01-09 19:14:44: Connecting to eDonkeyServer No2 (212.63.206.35 - 212.63.206.35:4242)
2009-01-09 19:14:47: Read 174 Kad contacts
2009-01-09 19:14:47: web server running on pid 10654
2009-01-09 19:14:48: ThreadScheduler: Completed task 'AICH Syncronizing', 0 tasks remaining.
2009-01-09 19:14:48: Failed to download the version check file
2009-01-09 19:14:48: Connected to eDonkeyServer No2 (212.63.206.35:4242)
2009-01-09 19:14:50: Kad started.
2009-01-09 19:14:50: Connecting to Sharing Kingdom 2 (89.248.172.50 - 89.248.172.50:4500)
2009-01-09 19:14:51: Connected to Sharing Kingdom 2 (89.248.172.50:4500)
2009-01-09 19:14:51: New external connection accepted
2009-01-09 19:14:51: Connecting client: aMuleweb 2.2.3
2009-01-09 19:14:51: Access granted.
2009-01-09 19:14:52: Connection established on: eDonkeyServer No2
2009-01-09 19:14:52: Connected to eDonkeyServer No2 with HighID
2009-01-09 19:14:52: New clientid is 109132695
2009-01-09 19:14:52: ServerMessage: server version 17.15 (lugdunum)
2009-01-09 19:14:52: ServerMessage: Sign up now and enjoy access to more than 80 terabytes of Videos, MP3s, Software, Games, Erotica and much more at full download speed!
2009-01-09 19:14:52: ServerMessage: http://www.eDonkey.to - 100% anonymous access to the news servers and files
2009-01-09 19:14:52: ServerMessage: GET ALL OF THIS FOR FREE !!! Click here to get a 3GB free trial !!! http://www.eDonkey.to
2009-01-09 19:14:52: ServerMessage: .    __       ___       ______ ______ ________     _________   __   ________     __     __
2009-01-09 19:14:52: ServerMessage: .   /   /      /       |    /__    __/__    __/    ____/    |   /    /__    __/  /__/  /   __     /    |   /    /   /   /
2009-01-09 19:14:52: ServerMessage: .  /   /     /   /  |   |      /    /        /    /   /    /__   /      | /    /    /    /       __    /   /    /   /      | /    /   /   /
2009-01-09 19:14:52: ServerMessage: . /_ /    /   ___   |   /    /        /    /   /    /___ /     /|      /    /    /      /    /   /   /__/  /     /|      /   /_ /
2009-01-09 19:14:52: ServerMessage: .( _ )  / _ /    |__\/ _ /        / _ /   / _____/ __/ |_  /    / _ /      / _ /   /_____ /  _/ |_   /   ( _ )
2009-01-09 19:15:04: Kad stopped.
2009-01-09 19:15:04: Connected to Kad (firewalled)
2009-01-09 19:15:26: Connected to Kad (ok)
2009-01-09 19:16:10: Disconnected from eD2k
2009-01-09 19:16:10: Wrote 181 Kad contacts
super:~ gtoso$

Another thing is the usual missing check in amuled :-(

Code: [Select]
super:~ gtoso$ amuled -f
Error: Could not unlock mutex (error 1: Operation not permitted)
Error: Could not unlock mutex (error 0: Unknown error: 0)
amuled: OnInit - starting timer
Initialising aMuled 2.2.3 using wxMac v2.8.9
WARNING: The check for other instances is currently disabled in amuled.
Please make sure that no other instance of aMule is running or your files might be corrupted.
HTTP download thread started
Host: amule.sourceforge.net:80
URL: http://amule.sourceforge.net/lastversion
Response: 200 (Error: 0)
Download size: 6
HTTP download thread ended
ListenSocket: Ok.
amuled: forking to background - see you
super:~ gtoso$

Logged

gtoso

  • Official MacOSX Packager
  • Full Member
  • ***
  • Karma: 24
  • Offline Offline
  • Posts: 206
Re: Can't connect to server or KAD with 2.2.3. Could anybody help me?
« Reply #4 on: January 09, 2009, 07:42:39 PM »

No.  :(
But I notice we have a lot of Mac problems lately (and Mac only). I wonder if just a lot of Mac users started using aMule, or if there's a real problem. However, I don't have a clue about Macs...

I hope the first one...
Recently, I used rarely amule.
And my old G3 does what it can...
Soon I will have a new Macbook with Leopard and I will be able to personally verify.
Logged

wuischke

  • Developer
  • Hero Member
  • *****
  • Karma: 183
  • Offline Offline
  • Posts: 4292
Re: Can't connect to server or KAD with 2.2.3. Could anybody help me?
« Reply #5 on: January 09, 2009, 08:39:19 PM »

Well, I know only a little bit more about Mac (I can could cross-compile for Mac OS X, but darwinux never worked. :( ), but our problems are missing developers (that's unfortunately no new situation) and missing knowledgeable testers (This one either.).

Anyway: In my opinion, the Mutexes are a serious problem. When threading goes wrong, bad things happen. (data corruption) But I have no clue how to research this, because forking is more Unix-y than using threads and that's where most of my experience is coming from.
Logged

gtoso

  • Official MacOSX Packager
  • Full Member
  • ***
  • Karma: 24
  • Offline Offline
  • Posts: 206
Re: Can't connect to server or KAD with 2.2.3. Could anybody help me?
« Reply #6 on: January 10, 2009, 12:12:01 PM »

Anyway: In my opinion, the Mutexes are a serious problem. When threading goes wrong, bad things happen. (data corruption) But I have no clue how to research this, because forking is more Unix-y than using threads and that's where most of my experience is coming from.

You are right,
I only tell that this problem is present from a long time (maybe from CVS pre 2.2.0),
so it should not be the cause of the user problem, but maybe I wrong...

The mutex problem seems to be connected to amuleweb,
without amuleweb autostart:

Code: [Select]
Initialising aMule 2.2.3 using wxMac v2.8.9
Checking if there is an instance already running...
No other instances are running.
HTTP download thread started
ListenSocket: Ok.
Loading temp files from /Volumes/Mastro/Mulo/Temp.

All PartFiles Loaded.
No shareable files found in directory: /Volumes/Mastro/Mulo/aMule Downloads
Host: amule.sourceforge.net:80
URL: http://amule.sourceforge.net/lastversion
Response: 0 (Error: 3)
WARNING: Void response on stream creation
HTTP download thread ended
Shutting down aMule...
aMule dialog destroyed
Now, exiting main app...
aMule OnExit: Terminating core.
aMule shutdown completed.

For now ignore the error on the version check: appears sporadically.

EDIT:
No, it's not an amuleweb problem,
amuled without amuleweb do mutex errors:

Code: [Select]
super:~ gtoso$ amuled -f
Error: Could not unlock mutex (error 1: Operation not permitted)
Error: Could not unlock mutex (error 0: Unknown error: 0)
amuled: OnInit - starting timer
Initialising aMuled 2.2.3 using wxMac v2.8.9
WARNING: The check for other instances is currently disabled in amuled.
Please make sure that no other instance of aMule is running or your files might be corrupted.
HTTP download thread started
Host: amule.sourceforge.net:80
URL: http://amule.sourceforge.net/lastversion
Response: 200 (Error: 0)
Download size: 6
HTTP download thread ended
ListenSocket: Ok.
amuled: forking to background - see you
super:~ gtoso$

I would be happy to help solve the problem, but alone I do not know where to start.

« Last Edit: January 10, 2009, 12:20:46 PM by gtoso »
Logged

wuischke

  • Developer
  • Hero Member
  • *****
  • Karma: 183
  • Offline Offline
  • Posts: 4292
Re: Mac problems with mutexes
« Reply #7 on: January 10, 2009, 01:59:35 PM »

Well, let's try to research the mutexes one after the other. Having a look at the log output for amuled, one thing caught my eye: The mutex problems before the OnInit function.

This means the following code (amuled.cpp:420 for 2_2_X) causes the problems:
Code: [Select]
CamuleDaemonApp::CamuleDaemonApp()
:
m_Exit(false),
m_table(new CAmuledGSocketFuncTable())
{
wxPendingEventsLocker = new wxCriticalSection;
}

Can you confirm this by setting debug output before and after the wxPending...?
Logged

gtoso

  • Official MacOSX Packager
  • Full Member
  • ***
  • Karma: 24
  • Offline Offline
  • Posts: 206
Re: Mac problems with mutexes
« Reply #8 on: January 10, 2009, 04:10:34 PM »

Simple printf are ok?
The problem seems after:

Code: [Select]
CamuleDaemonApp::CamuleDaemonApp()
:
m_Exit(false),
m_table(new CAmuledGSocketFuncTable())
{
        printf("\nMYDEBUG: before wxCriticalSection\n\n");
        wxPendingEventsLocker = new wxCriticalSection;
        printf("\nMYDEBUG: after wxCriticalSection\n\n");
}


Code: [Select]
super:~ gtoso$ amuled -f

MYDEBUG: before wxCriticalSection


MYDEBUG: after wxCriticalSection

Error: Could not unlock mutex (error 1: Operation not permitted)
Error: Could not unlock mutex (error 0: Unknown error: 0)
amuled: OnInit - starting timer
Initialising aMuled 2.2.3 using wxMac v2.8.9
WARNING: The check for other instances is currently disabled in amuled.
Please make sure that no other instance of aMule is running or your files might be corrupted.
Logged

GonoszTopi

  • The current man in charge of most things.
  • Administrator
  • Hero Member
  • *****
  • Karma: 169
  • Offline Offline
  • Posts: 2685
Re: Mac problems with mutexes
« Reply #9 on: January 10, 2009, 05:41:16 PM »

Well, the problem is with releasing the lock (mutex).

You can find mutex unlock instructions in (amuled.cpp):
CAmuledGSocketFuncTable::CAmuledGSocketFuncTable()
CAmuledGSocketFuncTable::AddSocket(GSocket *, GSocketEvent)
CAmuledGSocketFuncTable::RemoveSocket(GSocket *, GSocketEvent)
CAmuledGSocketFuncTable::RunSelect()
CDaemonAppTraits::CDaemonAppTraits(CAmuledGSocketFuncTable *)
CDaemonAppTraits::ScheduleForDestroy(wxObject *)
CDaemonAppTraits::RemoveFromPendingDelete(wxObject *)
CDaemonAppTraits::DeletePending()

You may try adding debug output around m_lock.Unlock() instructions, and also where the code is something like
Code: [Select]
{
        wxMutexLocker lock(m_lock);
        [...]
}
you may debug it with
Code: [Select]
{
       {
       wxMutexLocker lock(m_lock)
       [...]
       printf("before release");
       }
       printf("after release....");
}

This way you may find out which lock operation fails. Beware, though, that this would most likely result in LOTS of debug output, so you'd better redirect output to a file ;)

However, since unlock errors are not restricted to amuled, this may or may not give any result.
Logged
concordia cum veritate

gtoso

  • Official MacOSX Packager
  • Full Member
  • ***
  • Karma: 24
  • Offline Offline
  • Posts: 206
Re: Mac problems with mutexes
« Reply #10 on: January 10, 2009, 05:42:46 PM »

Some additional information, now I'm going to try to locate it.
Some ideas?

Code: [Select]
(gdb) continue
Continuing.
Reading symbols for shared libraries . done

Breakpoint 3, 0x0012dde0 in wxMutex::Unlock ()
(gdb) continue
Continuing.

Breakpoint 3, 0x0012dde0 in wxMutex::Unlock ()
(gdb) continue
Continuing.

Breakpoint 3, 0x0012dde0 in wxMutex::Unlock ()
(gdb) continue
Continuing.

MYDEBUG: before wxCriticalSection


MYDEBUG: after wxCriticalSection


Breakpoint 3, 0x0012dde0 in wxMutex::Unlock ()
(gdb) bt
#0  0x0012dde0 in wxMutex::Unlock ()
#1  0x00004bf0 in CDaemonAppTraits::CDaemonAppTraits ()
#2  0x00004c98 in CamuleDaemonApp::CreateTraits ()
#3  0x001244bc in wxAppConsole::GetTraits ()
#4  0x00215870 in wxFontMapperBase::Get () at pkcspad.cpp:117
#5  0x00353e50 in wxFontMapperModule::OnInit () at simple.h:23
#6  0x00216ffc in wxModule::DoInitializeModule () at pkcspad.cpp:117
#7  0x00217258 in wxModule::InitializeModules () at pkcspad.cpp:117
#8  0x00123f04 in wxEntryStart ()
#9  0x001240ec in wxEntry ()
#10 0x00003ac8 in main ()
(gdb) continue
Continuing.
Error: Could not unlock mutex (error 1: Operation not permitted)
Error: Could not unlock mutex (error 0: Unknown error: 0)

Breakpoint 2, 0x0000417c in CamuleDaemonApp::OnInit ()
(gdb)
Logged

gtoso

  • Official MacOSX Packager
  • Full Member
  • ***
  • Karma: 24
  • Offline Offline
  • Posts: 206
Re: Mac problems with mutexes
« Reply #11 on: January 10, 2009, 10:31:41 PM »

This way you may find out which lock operation fails. Beware, though, that this would most likely result in LOTS of debug output, so you'd better redirect output to a file ;)

However, since unlock errors are not restricted to amuled, this may or may not give any result.

You right, no result  :(
Mutex errors are on stderr, so I add fprintf (stderr, "....") to ensure correct output order.
I added 8 pair of fprintf (2 around m_lock.Unlock and 6 for lock blocks), but the problem is not in amuled.cpp:

Code: [Select]
super:~/mulo/aMule-2.2.3/src gtoso$ diff amuled.cpp.orig amuled.cpp
262a263
>       fprintf(stderr, "MYDEBUG: before Unlock [CAmuledGSocketFuncTable::CAmuledGSocketFuncTable]\n");
263a265
>       fprintf(stderr, "MYDEBUG: after Unlock [CAmuledGSocketFuncTable::CAmuledGSocketFuncTable]\n");
267a270
>       {
274a278,280
>       fprintf(stderr, "MYDEBUG: before release [CAmuledGSocketFuncTable::AddSocket]\n");
>       }
>       fprintf(stderr, "MYDEBUG: after release [CAmuledGSocketFuncTable::AddSocket]\n");
278a285
>       {
285a293,295
>       fprintf(stderr, "MYDEBUG: before release [CAmuledGSocketFuncTable::RemoveSocket]\n");
>       }
>       fprintf(stderr, "MYDEBUG: after release [CAmuledGSocketFuncTable::RemoveSocket]\n");
289a300
>       {
305a317,319
>       fprintf(stderr, "MYDEBUG: before release [CAmuledGSocketFuncTable::RunSelect]\n");
>       }
>       fprintf(stderr, "MYDEBUG: after release [CAmuledGSocketFuncTable::RunSelect]\n");
371a386
>       fprintf(stderr, "MYDEBUG: before Unlock [CDaemonAppTraits::CDaemonAppTraits]\n");
372a388
>       fprintf(stderr, "MYDEBUG: after Unlock [CDaemonAppTraits::CDaemonAppTraits]\n");
377a394
>       {
381a399,401
>       fprintf(stderr, "MYDEBUG: before release [CDaemonAppTraits::ScheduleForDestroy]\n");
>       }
>       fprintf(stderr, "MYDEBUG: after release [CDaemonAppTraits::ScheduleForDestroy]\n");
385a406
>       {
394a416,418
>       fprintf(stderr, "MYDEBUG: before release [CDaemonAppTraits::RemoveFromPendingDelete]\n");
>       }
>       fprintf(stderr, "MYDEBUG: after release [CDaemonAppTraits::RemoveFromPendingDelete]\n");
398a423
>       {
406a432,434
>       fprintf(stderr, "MYDEBUG: before release [CDaemonAppTraits::DeletePending]\n");
>       }
>       fprintf(stderr, "MYDEBUG: after release [CDaemonAppTraits::DeletePending]\n");
super:~/mulo/aMule-2.2.3/src gtoso$

Code: [Select]
MYDEBUG: before Unlock [CAmuledGSocketFuncTable::CAmuledGSocketFuncTable]
MYDEBUG: after Unlock [CAmuledGSocketFuncTable::CAmuledGSocketFuncTable]
MYDEBUG: before Unlock [CDaemonAppTraits::CDaemonAppTraits]
MYDEBUG: after Unlock [CDaemonAppTraits::CDaemonAppTraits]
Error: Could not unlock mutex (error 1: Operation not permitted)
Error: Could not unlock mutex (error 0: Unknown error: 0)
MYDEBUG: before release [CAmuledGSocketFuncTable::AddSocket]
MYDEBUG: after release [CAmuledGSocketFuncTable::AddSocket]
MYDEBUG: before release [CAmuledGSocketFuncTable::AddSocket]
MYDEBUG: after release [CAmuledGSocketFuncTable::AddSocket]
...

Just for info, stdout and stderr in attach.

Logged

gtoso

  • Official MacOSX Packager
  • Full Member
  • ***
  • Karma: 24
  • Offline Offline
  • Posts: 206
Re: Mac problems with mutexes
« Reply #12 on: January 10, 2009, 11:28:26 PM »

I tried to recompile only amuled-amuled.o and amuled adding -g -ggdb and then to step gdb until mutex error,
but I don't know if it may be useful, in attach full gdb output, here relevant part:

Code: [Select]
(gdb)
0x001387a4 in wxMBConv::FromWChar () at amuled.cpp:772
772     }
(gdb)
0x90129660 in memset ()
(gdb)
Single stepping until exit from function memset,
which has no line number information.
___bzero ()
    at /System/Library/Frameworks/System.framework/PrivateHeaders/ppc/cpu_capabilities.h:187
187     /System/Library/Frameworks/System.framework/PrivateHeaders/ppc/cpu_capabilities.h: No such file or directory.
        in /System/Library/Frameworks/System.framework/PrivateHeaders/ppc/cpu_capabilities.h
(gdb)
0x001ff760 in wxWC2MB () at pkcspad.cpp:117
117     pkcspad.cpp: No such file or directory.
        in pkcspad.cpp
(gdb)
0x001387e8 in wxMBConv::FromWChar () at amuled.cpp:772
772     }
(gdb)
0x90005ee0 in free ()
(gdb)
Single stepping until exit from function free,
which has no line number information.
0x0013829c in wxMBConv::cWC2MB () at amuled.cpp:772
772     }
(gdb)
0x000023f0 in dyld_stub_binding_helper ()
(gdb)
Single stepping until exit from function dyld_stub_binding_helper,
which has no line number information.
0x8fe01000 in __dyld_stub_binding_helper ()
(gdb)
Single stepping until exit from function __dyld_stub_binding_helper,
which has no line number information.
0x8fe156a0 in __dyld_stub_binding_helper_interface ()
(gdb)
Single stepping until exit from function __dyld_stub_binding_helper_interface,
which has no line number information.
0x90031c00 in fputs ()
(gdb)
Single stepping until exit from function fputs,
which has no line number information.
Error: Could not unlock mutex (error 1: Operation not permitted)
Error: Could not unlock mutex (error 0: Unknown error: 0)
0x00217b64 in wxMessageOutputBest::Printf () at pkcspad.cpp:117
117     pkcspad.cpp: No such file or directory.
        in pkcspad.cpp
(gdb)
0x00184f6c in wxLogBuffer::Flush () at amuled.cpp:772
772     }
(gdb)
0x90005ee0 in free ()
(gdb)
Single stepping until exit from function free,
which has no line number information.
0x9000648c in szone_free ()
(gdb)
Single stepping until exit from function szone_free,
which has no line number information.
0x0012a7b8 in wxStringBase::erase () at amuled.cpp:772
772     }

EDIT:
line number in amuled.cpp refer to my modified version   :(
patch in attach

« Last Edit: January 10, 2009, 11:33:15 PM by gtoso »
Logged

GonoszTopi

  • The current man in charge of most things.
  • Administrator
  • Hero Member
  • *****
  • Karma: 169
  • Offline Offline
  • Posts: 2685
Re: Mac problems with mutexes
« Reply #13 on: January 10, 2009, 11:40:06 PM »

Knowing where the problem is not is almost as important as knowing where it is.

The ultimate solution would be to set a breakpoint in wxWidgets itself on the error reporting call, so that we could have a backtrace and see what's going on.

Mutex unlock errors are reported:
wxWidgets-2.8.9/src/mac/carbon/mpthread.cpp:301
wxWidgets-2.8.9/src/mac/carbon/thread.cpp:404
wxWidgets-2.8.9/src/mac/carbon/thread.cpp:494

Most likely only one of these addresses are compiled into the library, you have to find out which.
Logged
concordia cum veritate

GonoszTopi

  • The current man in charge of most things.
  • Administrator
  • Hero Member
  • *****
  • Karma: 169
  • Offline Offline
  • Posts: 2685
Re: Mac problems with mutexes
« Reply #14 on: January 10, 2009, 11:50:36 PM »

It seems that these two mutex errors are happening when returning from the function 'CamuleDaemonApp::ShowAlert()'. Strange. This can also indicate a bug in wxWidgets itself, as I suspect from the log you posted.
Logged
concordia cum veritate
Pages: [1] 2