Hi "ne555"
I like that name! :-) ... Electronics fan?
First of all. I tried the "ulimit" but that did not help anything.
I just uploaded the changed debug-code to github:
https://github.com/on1arf/thelinkbox-on1arf.git
After cloning it, you'll need to change one thing first:
Edit the file testit/tlb-pa.conf
There is a line that says:
WorkingDir = /home/kristoff/ham/thelinkbox-on1arf/testit
You'll need to change that to make it fit your directory structure
After that:
* TEST 1: original code:
$ ./configure
$ make clean
$ make
This will compile the original code! (without the "portaudio" changes I made)
Note there is quite a bit of debug-code in there, so ignore the warning in configvars
configvars.cpp:1266:39: warning: format ‘%X’ expects argument of type ‘unsigned int’, but argument 3 has type ‘CPort*’ [-Wformat]
These are the result of the "fprintf("%X", ..." debug code so can be ignore.
run it:
--- cut here --- cut here --- cut here --- cut here ---
$ ./linkbox/tlb -f testit/tlb-pa.conf
thelinkbox Version 0.53 compiled Dec 19 2013 08:31:58
CreatePort = (null), x = 0
CreatePort = 2meters, x = 0
p_pPort = 0
before: Arg = *2meters*
p_pPort = A011448
addr pPort->NodeName = A01144C
zzz = 0
zzz = 0, strlen(arg) = 7
zzz = A011A90
if zzz =
zzz = 2meters
addr pPort->NodeName = A01144C
After: Arg = 2meters
LoadCommands: Unable to open "tlb.cmds" - No such file or directory (2)
Come on now, your email address isn't "w1aw@arrl.net" is it?
The email address is optional, please either delete the entry
or provide a valid email address.
--- cut here --- cut here --- cut here --- cut here ---
This is normal. The test configuration-file is not correct so the application stops there.
But the important element is that the "CreatePort" code is executed and executed correctly.
(BTW, there are indeed two "sleep" commands in the debug-session).
Let me explain a little bit how the application seams to work:
As you can see, the "thelinkbox" application (which is an application for voice-over-ip/radio-over-ip for ham-radio) has a configuration file (as specified by the -f argument):
In my case, it is "testit/tlb-pa.conf"
The main configuration file contains the line:
--- cut here --- cut here ---
include port0-pa.conf
--- cut here --- cut here ---
This includes "port0-pa.conf", which is a configuration-file per port (i.e. a radio-interface).
This port-configuration file starts with this line:
--- cut here --- cut here ---
CreatePort=2meters
--- cut here --- cut here ---
The code in the application behind this works as follows:
There is a function "Createport" (found in linkbox/configvars.cpp) which:
- it creates an object "CPorts" with the name "pPort".
- it initialised some data
- one of the initiailisation is that it copies the name of the port (in this case: "2meters") to pPort->Nodename)
In the original code, this work OK.
(For some reason, the code is called twice, but the first call has an empty argument; tat is rejected in the code).
The application that continues to read port-configuration file, then returns to the main configuration file, when it stops on the line:
"EmailAdr = w1aw@arrl.net"
(which is the email-adress of one of the original authors. As this is clearly not correct, the application stops here).
* TEST 2:
implement my changes:
$ cp testit/linkbox_Makefile linkbox/Makefile
This will add the lines the following lines in Makefiile
-D__PORTAUDIO__
-lportaudio
In ports.h, look for __NEEDPORTAUDIO__ instead
As a result, my portaudio code will be added in the code and portaudio library will be linked
(NO ./configure!)
$ make clean
$ make
Now, run again:
$ ./linkbox/tlb -f testit/tlb-pa.conf
thelinkbox Version 0.53 compiled Dec 19 2013 08:58:30
CreatePort = (null), x = 0
CreatePort = 2meters, x = 0
p_pPort = 0
before: Arg = *2meters*
p_pPort = 86C4468
addr pPort->NodeName = 86C446C
zzz = B74DDAEF
zzz = 0, strlen(arg) = 7
*** glibc detected *** ./linkbox/tlb: malloc(): memory corruption (fast): 0x086c4ab0 ***
(you will probably need to do "killall -9 tlb" in another window to get the application to stop).
So, the application crashes on a "glibc memory corruption detection" error.
In the code that is now on github, the almost all of my changes have been removed:
I changed the "__PORTAUDIO__" or "__NEEDPORTAUDIO__" with "__PORTAUDIODEBUG__" or "__NEEDPORTAUDIODEBUG__" so they are not included in the source.
In fact, the only lines that are included are:
* linkbox/ports.cpp (lines 305-320):
include "portaudio.h" + define some values
* linkbox/ports.h (line 177-190):
define structure pashare_str
* linkbox/ports.h (line 324-341):
Declare vars in object
The key to this all seams to be these three lines:
PaStreamParameters outputParameters;
PaStreamParameters inputParameters;
pashared_str pa; // data shared between object and portaudio callback function
If you comment them out, recompile the code ("make clean && make"), the application does work. If you include them in the source-code, the application crashes on the glibc error.
BTW. I also tested this on an old mac-mini running debian today. Same problem.
So I have this issue on three different platforms: i386, ARM (Raspi) and PowerPC (macmini G3).
I am really puzzled here!
Cheerio! Kr. Bonne.