"overflow in thread FTP" after upgrading mavproxy

I just upgraded mavproxy on Ubuntu 18 using “pip3 install upgrade mavproxy”. (I also upgraded the python 2 libraries as well.) I am running SITL with Copter-4.0. When I run it now, I get this error in the SITL window:

Serial port 3 on TCP port 5763
validate_structures:411: Validating structures
Loaded defaults from /home/rrr6399/3dr/ardupilot/Tools/autotest/default_params/copter.parm,/home/rrr6399/3dr/ardupilot/Tools/autotest/default_params/copter-hexa.parm
stack overflow in thread FTP

Running: sh dumpstack 3558 >segv_arducopter.3558.out 2>&1
Failed

I tried it with Python 2 and 3 and even performed a clean build of ArduCopter. Any ideas what would cause this?

It appears that is a problem with MAVProxy 1.8.19, but not 1.8.18. I reverted to 1.8.18 and it works fine now.

This is fixed by this PR. I’m just using a local branch for SITL testing right now until this makes it into a release.

It is also discussed in this issue.

The problem isn’t MAVProxy here.

The new MAVProxy is trying to use the “ftp” module to download parameters
really fast.

Sadly, you appear to be using a version of ArduPilot which is faulty.

I’m really, really hoping you’re not running today’s master branch; we
fixed an overflow many weeks ago in that area.

Try updating to today’s master and see what happens?

What version were you running?

Peter

I’m using the Copter-4.0 branch. Should it work on that branch or only on Master?

There’s no excuse for a stack overflow in any of our current branches.

The patch I thought ought to fix this problem is present in the 4.0.3
branch (tag, actually):

Was this the change in GCS_FTP.cpp that was supposed to fix the issue:

   if (!hal.scheduler->thread_create(FUNCTOR_BIND_MEMBER(&GCS_MAVLINK::ftp_worker, void),
                                      "FTP", 3072, AP_HAL::Scheduler::PRIORITY_IO, 0)) {
        goto failed;
    }

It was, yes. Has that not fixed the problem for you? Because that would
be a really serious issue for us.

Peter

I am also seeing this error at commit c9d8edda4 (ArduPlane-4.0.4) and mavproxy 1.8.19, running in SITL, starting with sim_vehicle.py -v ArduPlane

I just pulled and ran Copter-4.0 branch and plane4.0 branches in SITL and got the stack overflow from FTP. I am using master branch mavproxy, but I recall from a few weeks ago I got the same result from running MissionPlanner latest beta. Master branch plane SITL works just fine.

I crossed this with @tridge - it’s apparently a false-positive as you can
make that stack as large as you like and you’ll still get the error.

This is still absolutely no good - we don’t want people ignoring these or
thinking they’re, “just something ArduPilot says”.

I’ll try to track it down in the next week.

… or today…

So I thought this felt familiar. Here’s the PR that went into master;
I’ve marked it for back-porting into Plane 4.0

Yep. You mentioned earlier in a github comment that commit f504009 “fixes” it. Fetching that commit into Plane Stable works great for me. Windows 10 1909 running WSL1 with Ubuntu 18.04.