Guenael / rtlsdr-wsprd

WSPR daemon for RTL receivers
GNU General Public License v3.0
112 stars 32 forks source link

"Caught signal 11" - looping after one period #4

Closed sm3ulc closed 8 years ago

sm3ulc commented 8 years ago

I run "rtlsdr_wsprd -c xxx -l xxxx -g 20 -p -23 -o 125000000 -f 10138.6k" on my rpi-1B and it starts ok and run one period and right after just prints "Caught signal 11" in a loop. Unhandled crash?

Trace of one run can be found here: (started some 77s before interval)

http://www.update.uu.se/~davidl/tmp/wsprd-trace

Guenael commented 8 years ago

Well, it could be a buffer overflow or a problem with the driver callback (low or no response). Your rpi 1 has only one core, and the decoding process takes a lot of CPU. I use 2 threads and if this second thread used for decoding takes too much CPU, the driver could not be able to push the samples. I'm not sure, but it could be good explanation. Could you try with a rpi 2 ? A solution could be to change the decoding thread priority (code side), but I have no guarantees.

Guenael commented 8 years ago

BTW, thx for reporting this issue.

Guenael commented 8 years ago

Benchmark : https://www.raspberrypistarterkits.com/2016/03/04/raspberry-pi-3-pi-2-pi-b-benchmark-review/

sm3ulc commented 8 years ago

Have been running a few tests on the 1B:

110s raw 250 kS IQ and demodulated with csdr to wav with 12k samplerate. The decoding with wsprd (from wsjt) takes 4 seconds. rtlsd_wsprd takes about 23% of cpu when running. Should be pretty fine with the cpu-power i think. Maybe adding lower priority to the decodingthread in order to not disturb the realtime sampling.

I don't own a pi2 so can't do testing on that model.

Btw.. demodulation with csdr as I run it via my script it takes 92 seconds just to demod on the 1B..

Guenael commented 8 years ago

Ok, I will try to fix this using pthread_attr_setschedparam. Note to myself :

include

include

pthread_attr_t tattr; pthread_t tid; int ret; int newprio = 20; sched_param param;

/* initialized with default attributes */ ret = pthread_attr_init (&tattr);

/* safe to get existing scheduling param */ ret = pthread_attr_getschedparam (&tattr, &param);

/* set the priority; others are unchanged */ param.sched_priority = newprio;

/* setting the new scheduling param */ ret = pthread_attr_setschedparam (&tattr, &param);

/* with new priority specified */ ret = pthread_create (&tid, &tattr, func, arg);

Guenael commented 8 years ago

Hello, Pthread priority added, but I have no RPi-1 to test this functionality.

Guenael commented 8 years ago

Issue not solved, same problem reported (by VE2VAX)

ve2vax commented 8 years ago

use the -S (single pass mode, no subtraction (same as original wsprd)).

Solved the problem for me. ./rtlsdr_wsprd -f 144.489M -c VE2VAX -l FN35JO -a 1 -S

ve2vax commented 8 years ago

The problem , happen when dec_options.subtraction is set =1

sm3ulc commented 8 years ago

Is the code pushed?

Skickat från min Samsung-enhet

-------- Originalmeddelande -------- Från: "Guenael, VA2GKA" notifications@github.com Datum: 25-06-2016 03:00 (GMT+01:00) Till: Guenael/rtlsdr-wsprd rtlsdr-wsprd@noreply.github.com Kopia: sm3ulc sm3ulc@gmail.com, Author author@noreply.github.com Rubrik: Re: [Guenael/rtlsdr-wsprd] "Caught signal 11" - looping after one period (#4)

Hello,

Pthread priority added, but I have no RPi-1 to test this functionality.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

Guenael commented 8 years ago

Yep, the code is updated, but I'm not sure if the priority works really. I'll need to take time to check this point carefully. @ve2vax : The fano alog take more processing (option substraction). The program crash when the callback is not available. The only way to fix this is using a very low priority. But for now, it don't works... BTW, thanks for helping.

sm3ulc commented 8 years ago

I can test code monday night. Utc+1 :) // David Skickat från min Samsung-enhet

-------- Originalmeddelande -------- Från: "Guenael, VA2GKA" notifications@github.com Datum: 25-06-2016 19:45 (GMT+01:00) Till: Guenael/rtlsdr-wsprd rtlsdr-wsprd@noreply.github.com Kopia: sm3ulc sm3ulc@gmail.com, Author author@noreply.github.com Rubrik: Re: [Guenael/rtlsdr-wsprd] "Caught signal 11" - looping after one period (#4)

Yep, the code is updated, but I'm not sure if the priority works really. I'll need to take time to check this point carefully.

@ve2vax : The fano alog take more processing (option substraction). The program crash when the callback is not available. The only way to fix this is using a very low priority. But for now, it don't works...

BTW, thanks for helping.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

sm3ulc commented 8 years ago

Hi all!

Finally had the ability to do a quick test on an rpi1b. Seem to get some runs with no signal11 stops and some runs it seems ok.

73

// David

On Sun, Jun 26, 2016 at 1:33 AM, David sm3ulc@gmail.com wrote:

I can test code monday night. Utc+1 :)

// David

Skickat från min Samsung-enhet

-------- Originalmeddelande -------- Från: "Guenael, VA2GKA" notifications@github.com Datum: 25-06-2016 19:45 (GMT+01:00) Till: Guenael/rtlsdr-wsprd rtlsdr-wsprd@noreply.github.com Kopia: sm3ulc sm3ulc@gmail.com, Author author@noreply.github.com Rubrik: Re: [Guenael/rtlsdr-wsprd] "Caught signal 11" - looping after one period (#4)

Yep, the code is updated, but I'm not sure if the priority works really. I'll need to take time to check this point carefully. @ve2vax https://github.com/ve2vax : The fano alog take more processing (option substraction). The program crash when the callback is not available. The only way to fix this is using a very low priority. But for now, it don't works... BTW, thanks for helping.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Guenael/rtlsdr-wsprd/issues/4#issuecomment-228561681, or mute the thread https://github.com/notifications/unsubscribe/ARdPKdqNBBDwTKnBJ6cz8o7HPMNvLHisks5qPWk4gaJpZM4I2x0z .

Guenael commented 8 years ago

Hello, I fixed a malloc bug present only with gcc5 (usually the case with Raspberrian). Please retest. Thx.

Guenael commented 8 years ago

I tested this update on RPi 1 during 48h without issue. But some versions of Raspberian react badly with USB, I added a note to the README file :

I noticed some disconnection problems with USB port while using Raspbian Jessie (2016-05-27-raspbian-jessie-lite.img). I rollbacked to Raspbian Wheezy (2015-02-16-raspbian-wheezy.img) and the problems solved by themself magically... For now, I have not investigated this issue, but if you experience some "Caught signal 11" error message, it could be this same problem. For now, I would recommend Raspbian Wheezy v2015-02-16.

Closing this issue. Thx

zodoczi commented 7 years ago

Hello,

I see the same problem, using RPi 3 with 2017-01-11-raspbian-jessie.img

73, Zoltan

caught_signal_11.txt

rbw42 commented 6 years ago

Hi all, I'm running a pi2 with jessie having the same problem.

Not sure if this code is still being maintained, but this problem appears to be a bug due to unsafe string handling in wsprsim_utils.c. There are several places where something could go wrong, but I have fixed this problem with a combination of stack smashing protection compiler options (which doesn't fix the actual problem) and changing the size of the temporary string message[23] in wsprsim_utils.c to be 24 chars, not 23. Also ensuring that string is properly terminated.

So around line 189, change the variable declarations and array initialisation to:

char grid4[5], message[24];

memset(message,0,sizeof(message));

I can send a patch if that is useful.

Regards, Randall