Announcing PiAware 3! (Latest version: 3.8.0)

mmm, strange,

When i check in the piaware.logs since 10 march, the problem occours after upgrading to 3.7.0.1,
Nothing changed in the hardware-setup…

It’s not the dongle stuck, the error we both had stops faup from operating until it automatically restarts.
You posted the errors independently, but you can see no messages being received by piaware after the other error.

I’ve put in something to catch the split error:

198         if {[catch {array set row [split $line "\t"]} catchResult] == 1} {
199             logger "got '$catchResult' reading from $prettyName"
200             logger "Uneven number of elements: '$line'"
201             faup_restart
202             return
203         }
204         array set row [split $line "\t"]

This is what it caught:

Apr 07 21:42:42 x230 piaware[17780]: got 'list must have an even number of elements' reading from faup1090
Apr 07 21:42:42 x230 piaware[17780]: Uneven number of elements: '_v        4E        clock        1554666161        hexid        48AD81        addrtype        adsb_icao        adsb_version        2        category        A3        nac_p        10 0 A        nac_v        2 0 A        sil        3 0 A        sil_type        perhour 0 A        nic_baro        1 0 A        airGround        A+ 0 A        squawk        4716 2 A        ident        {LOT2EL  } 17 A        alt        37000 0 A        position        {50.14105 9.35522 8 186} 0 A        alt_gnss        36700 0 A        vrate        128 0 A        vrate_geom        64 1 U        speed        424.7 0 A        speed_ias        247 1 U        speed_tas        434 1 U        mach        0.764 1 U        track        108.0 0 A        track_rate        0.03 1 U        roll        0.2 1 U        heading_magnetic        107.8 1 U        nav_alt_mcp        37024 0 A        nav_alt_fms        37008 1 U        nav_alt_src        aircraft 1 U        nav_modes        {autopilot althold tcas} 0 A        nav_qnh        1013.6 0 A        emergency        none 2 A
Apr 07 21:42:42 x230 piaware[17780]: _v        4E        clock        1554666150        hexid        44029F        airGround        A+ 0 S        squawk        5244 0 U        alt        37000 4 U'
--
Apr 08 04:11:02 x230 piaware[9040]: got 'list must have an even number of elements' reading from faup1090
Apr 08 04:11:02 x230 piaware[9040]: Uneven number of elements: '_v        4E        clock        1554689461        hexid        AE1467        addrtype        adsb_icao        adsb_version        2        category        A5        nac_p        9 0 A        nac_v        2 0 A        sil        3 0 A        sil_type        perhour 0 A        nic_baro        1 0 A        airGround        A+ 0 A        squawk        6437 0 A        ident        {RCH122  } 9 A        alt        29675 0 A        position        {49.72563 9.82301 9 75} 0 A        alt_gnss        29575 0 A        vrate        576 0 U        vrate_geom        704 0 A        speed        420.9 0 A        speed_ias        279 0 U        speed_tas        430 2 U        mach        0.736 0 U        track        86.2 0 A        track_rate        0.00 2 U        roll        -0.2 2 U        heading_magnetic        86.5 0 U        nav_alt_mcp        31008 2 A        nav_alt_fms        30992 1 U        nav_alt_src        fms 1 U        nav_heading        87.2 2 A        nav_modes        {vnav tcas} 2 A        nav_qnh        1013.6 2 A        emergency        none 0 A
Apr 08 04:11:02 x230 piaware[9040]: _v        4E        clock        1554689462        hexid        A3E89A        nac_p        9 0 A        airGround        A+ 0 A        squawk        3234 3 A        ident        {CMB595  } 4 A        alt        40000 0 A        position        {49.70136 10.07001 8 186} 0 A        alt_gnss        39500 0 A        vrate        0 0 A        vrate_geom        32 0 U        speed        461.9 0 A        speed_ias        240 0 U        speed_tas        460 0 U        mach        0.792 0 U        track        293.1 0 A        track_rate        0.00 0 U        roll        -0.4 0 U        heading_magnetic        290.9 0 U        nav_alt_mcp        40000 0 A        nav_alt_fms        40000 0 U        nav_heading        290.4 0 A        nav_qnh        1013.6 0 A        emergency        none 3 A'

So it seems one of the lines is missing \n at the end of the line, otherwise they would not both be printed by the logger at once.

And while you are correct the following call so safe_snprintf would trigger the overflow, it doesn’t trigger your detection if exactly the last \n is replaced by \0
Because vsnprintf wrote exactly 1 character, just not the one you wanted to write.
return value == size is one of the error cases basically and this is not checked.

1909     p = safe_snprintf(p, end, "\n");
1910 
1911     if (p <= end)
1912         completeWrite(&Modes.fatsv_out, p);

So it should still be if (p < end) to detect that case.
(Not that it really matters when the buffer is big enough but it’s nice only getting the overflow warning instead of faup crashing)

Edit: Nevermind, i’m not sure i understand the output after catching the error.
The '$line' should be on one line, not on two.
Maybe you can figure it out :slight_smile:

Nonetheless converting the 8 spaces back to 1 space, the first line of the two caught after the error is exactly 600 characters, so (p<end) is probably a correct solution to the problem.
Not sure why it is displayed by tcl on two lines though, maybe it’s making a new line because of the \0 but doesn’t use it for splitting lines when reading the input?

Hm, I think I misunderstood [v]snprintf; in the case where the output buffer is too small, I expected it to not write a \0 (i.e. you end up with an unterminated buffer) but it looks like that is not correct.

I’ll revisit this when I’m able to work on this again (it may be a few weeks)

It’s not that important, increasing the buffer should do the trick :slight_smile:

Just wanted to get to the root cause of the split error, that error means no messages to Flightaware for an hour until piaware decides to restart everything.

Where can I increase the buffer size, in which file can i find TSV_MAX_PACKET_SIZE ?

Did you compile piaware? In that case it is located here:

piaware_builder/package-stretch/dump1090/net_io.c

#define TSV_MAX_PACKET_SIZE 600

(line 1881, making it 700 should be plenty)
And i was talking about the buffer which is defined by the max packet size, so changing that number is sufficient. Haven’t tested increasing it though, don’t know if it could cause other issues but at first glance i don’t think so.

If you are using the sd-card image you’ll just have to wait for a fix or switch back to 3.6.3 for now.

2 Likes

Lets see and try :slight_smile:

Up and running …now we wait :innocent:

Mmmm

faup1090(16681): fatsv: output too large (max 600, overran by 1)

cough you need to build piaware again and reinstall it cough

Oh a little caveat, you must not run sensible-build.sh again, it will overwrite your changes to the source files in the folder package-stretch :slight_smile:

My mistake , build the wrong version :woozy_face:

Just as a more tidy writeup of my understanding of the problem and a good place for you to check back in a couple of weeks, a pull request on github:
Overflow fix by wiedehopf · Pull Request #40 · flightaware/dump1090 · GitHub

2 Likes

Build Piaware again with

#define TSV_MAX_PACKET_SIZE 700

Running fine :slight_smile:

1 Like

So for those of us who don’t want to get into a science experiment, wait until 3.7.0.2 or 3.7.1?

The testing image is mostly for UAT support.
If you don’t want UAT support there is almost no difference to 3.6.3.

Once it is released your installation should upgrade automatically if you have that enabled.

1 Like

Don’t know what UAT is… :wink: I’m good then!

1 Like

ok, stupid question time because it’s been a long time since Ive done this (or thought about doing it).

I want to edit config.js to change the range ring distances.

I’ve seen lots of posts how to do it, but they all assume you know how to get a prompt and I can’t remember or figure out how to get to the command prompt in the Raspberry Pi to make those changes.

I know the answer probably is keyboard and mouse and HDMI to a monitor, but there has to be a better way for me.

I have windows 10, the Piaware is on my same home router. When I go to my router and look at the devices, I type in the IP of the Piaware and it takes me to a status screen, not something that might yield a command prompt for me to change directory and then edit the config.js file.

I thought the last time I did something to the configuration settings, I did it from my account’s “MY ADS-B” where there would be a box to enter commands but I just looked and those seem to be fixed commands without something for me to enter a custom command like the change directory command and then eventually the editor command to edit config.js.

I am glad this was dummy proof that I could install piaware on a microsd card and put it in a Pi (I’m an arduino user, not a raspberry pi user) but it leads to problems trying to figure out how to easily get a Pi command line.

Thanks for any help.

You will be looking to use SSH on your pc to bring up a terminal session on the pi.

You would normally use a program called Putty.

You will need to have enabled SSH on the pi by creating an empty file called ssh. If you did it initially it will still be there otherwise pop the sdcard back into the pc.

S.

I’m familiar with Putty - I have to use it to SSH into my ISP account that runs on some flavor of linux when I have files to update on my webpage.

I doubt I have the blank SSH file on my Pi as I did the dummy method of taking the equivalent of an ISO file distribution and used some software to burn it to the microSD card in the right format and directory structure that was needed for Piaware on the Pi.

Since you are telling me that I can take the microSD card and plug it into my PC microSD card reader, it is in a format that I’m able to look at with windows explorer and add the SSH file or edit the config.js file directly?
Thanks.

For Beginners - How-to SSH to RPi - Setup Putty in Windows

Once you are on the prompt you can change directory with:
cd /usr/share/dump1090-fa/html

to edit, you can use nano for example, as you need root permissions to edit the file you need to use sudo as well:
sudo nano config.js
(sudo makes you root for the following command only)

Ctrl-x to exit, it will ask you wether to save, say y for yes and press enter when prompted for the path (stays the same).