[squid-users] [ext] Re: ftp related crash in squid-6.0.0-20220905-r9358e99f9

Alex Rousskov rousskov at measurement-factory.com
Mon Jun 19 22:10:28 UTC 2023


On 6/19/23 16:44, Ralf Hildebrandt wrote:
> I hope I got it all cut&pasted

This information was very useful, thank you!


> storedWholeReply_ = "ftpReadTransferDone code 226 or 250"

I suspect that the current Client::markParsedVirginReplyAsWhole() 
assumptions about received-vs-stored response data do not match our FTP 
code (in this particular use case). It is not clear to me whether 
Ftp::Gateway code is not storing any response headers at all this case 
(a bug) OR it is calling that method prematurely, before storing 
response headers (a different bug). Either way, FwdState gets a 
"complete" but empty Store entry, which is not supposed to happen 
(because every Store entry has HTTP response headers or equivalent), and 
Squid asserts.

Unfortunately, I do not remember enough about FTP code to quickly triage 
this further. I recommend filing a bug report with Squid bugzilla in 
hope that somebody will volunteer a bug fix (or, at least, a workaround).


Thank you,

Alex.


>>      frame 3
> #3  0x000055555570e9c2 in FwdState::completed (this=this at entry=0x55556c0a4748) at FwdState.cc:299
> 299            assert(!storedWholeReply_);
> 
>>      print this
> $1 = (FwdState * const) 0x55556c0a4748
> 
> $2 = {
>    <Lock> = {
>      _vptr.Lock = 0x555555b6c3b8 <vtable for FwdState+88>,
>      count_ = 2
>    },
>    <PeerSelectionInitiator> = {
>      <CbdataParent> = {
>        _vptr.CbdataParent = 0x555555b6c378 <vtable for FwdState+24>
>      },
>      members of PeerSelectionInitiator:
>      subscribed = false
>    },
>    members of FwdState:
>    entry = 0x55555e31aaf0,
>    request = 0x55562827ab90,
>    al = {
>      p_ = 0x5555b6ecaec0
>    },
>    self = {
>      p_ = 0x55556c0a4748
>    },
>    err = 0x0,
>    clientConn = {
>      p_ = 0x5555dafd6ea0
>    },
>    start_t = 1687188676,
>    n_tries = 1,
>    flags = {
>      connected_okay = true,
>      dont_retry = false,
>      forward_completed = true,
>      destinationsFound = true
>    },
>    transportWait = {
>      <JobWaitBase> = {
>        job_ = {
>          cbc = 0x0,
>          lock = 0x0
>        },
>        callback_ = {
>          p_ = 0x0
>        }
>      },
>      members of JobWait<HappyConnOpener>:
>      typedJob_ = {
>        cbc = 0x55566ccd1888,
>        lock = 0x55566ccd1888
>      }
>    },
>    encryptionWait = {
>      <JobWaitBase> = {
>        job_ = {
>          cbc = 0x0,
>          lock = 0x0
>        },
>        callback_ = {
>          p_ = 0x0
>        }
>      },
>      members of JobWait<Security::PeerConnector>:
>      typedJob_ = {
>        cbc = 0x0,
>        lock = 0x0
>      }
>    },
>    peerWait = {
>      <JobWaitBase> = {
>        job_ = {
>          cbc = 0x0,
>          lock = 0x0
>        },
>        callback_ = {
>          p_ = 0x0
>        }
>      },
>      members of JobWait<Http::Tunneler>:
>      typedJob_ = {
>        cbc = 0x0,
>        lock = 0x0
>      }
>    },
>    waitingForDispatched = false,
>    destinations = {
>      p_ = 0x555654304b50
>    },
>    serverConn = {
>      p_ = 0x0
>    },
>    destinationReceipt = {
>      connection_ = {
>        p_ = 0x0
>      },
>      position_ = 18446744073709551615
>    },
>    closeHandler = {
>      p_ = 0x0
>    },
>    pconnRace = FwdState::raceImpossible,
>    storedWholeReply_ = 0x555555a94350 "ftpReadTransferDone code 226 or 250"
> }
> 
>> print *entry
> 
> $3 = {
>    <hash_link> = {
>      key = 0x55556bfa3d50,
>      next = 0x5555b6b68468
>    },
>    <Packable> = {
>      _vptr.Packable = 0x555555b6ec50 <vtable for StoreEntry+16>
>    },
>    members of StoreEntry:
>    mem_obj = 0x55559cd62ca0,
>    repl = {
>      data = 0x0
>    },
>    timestamp = -1,
>    lastref = 1687188676,
>    expires = -1,
>    lastModified_ = -1,
>    swap_file_sz = 0,
>    refcount = 1,
>    flags = 1216,
>    swap_filen = -1,
>    swap_dirn = -1,
>    mem_status = NOT_IN_MEMORY,
>    ping_status = PING_DONE,
>    store_status = STORE_PENDING,
>    swap_status = SWAPOUT_NONE,
>    cachedESITree = {
>      p_ = 0x0
>    },
>    lock_count = 3,
>    shareableWhenPrivate = false,
>    deferredProducer = {
>      p_ = 0x0
>    }
> }
> 
>> print *entry->mem_obj
> 
> $4 = {
>    appliedUpdates = false,
>    method = {
>      theMethod = Http::METHOD_GET,
>      theImage = {
>        id = {
>          value = 99694914
>        },
>        store_ = {
>          p_ = 0x555555cb57d0
>        },
>        off_ = 0,
>        len_ = 0
>      }
>    },
>    data_hdr = {
>      inmem_hi = 0,
>      nodes = {
>        head = 0x0,
>        elements = 0
>      }
>    },
>    inmem_lo = 0,
>    clients = {
>      head = 0x55555acdbe30,
>      tail = 0x55555acdbe30
>    },
>    nclients = 1,
>    swapout = {
>      queue_offset = 0,
>      sio = {
>        p_ = 0x0
>      },
>      decision = MemObject::SwapOut::swNeedsCheck
>    },
>    xitTable = {
>      index = -1,
>      io = Store::ioUndecided
>    },
>    memCache = {
>      index = -1,
>      offset = 0,
>      io = Store::ioUndecided
>    },
>    request = {
>      p_ = 0x55562827ab90
>    },
>    start_ping = {
>      tv_sec = 0,
>      tv_usec = 0
>    },
>    ping_reply_callback = 0x0,
>    ircb_data = 0x0,
>    abortCallback = {
>      p_ = 0x5556543f35b0
>    },
>    repl = {
>      data = 0x0
>    },
>    id = 105121620,
>    object_sz = -1,
>    swap_hdr_sz = 0,
>    vary_headers = {
>      id = {
>        value = 99694915
>      },
>      store_ = {
>        p_ = 0x555555cb57d0
>      },
>      off_ = 0,
>      len_ = 0
>    },
>    reply_ = {
>      p_ = 0x55563217e040
>    },
>    updatedReply_ = {
>      p_ = 0x0
>    },
>    storeId_ = {
>      size_ = 40,
>      len_ = 35,
>      buf_ = 0x5555df5d7a50 "ftp://ftp.nimblestorage.com/upload/"
>    },
>    logUri_ = {
>      size_ = 40,
>      len_ = 35,
>      buf_ = 0x5555e78446a0 "ftp://ftp.nimblestorage.com/upload/"
>    },
>    deferredReads = {
>      deferredReads = {
>        head = {
>          p_ = 0x0
>        },
>        tail = {
>          p_ = 0x0
>        },
>        length = 0
>      }
>    }
> }
> 
>> frame 10
> #10 0x00005555558816f6 in Ftp::Gateway::handleControlReply (this=0x5555662702c8) at FtpGateway.cc:1176
> 1176	    FTP_SM_FUNCS[state] (this);
> 
>> print this
> $5 = (Ftp::Gateway * const) 0x5555662702c8
> 
>> print *this
> $6 = {
>    <Ftp::Client> = {
>      <Client> = {
>        <Adaptation::Initiator> = {
>          <AsyncJob> = {
>            <CbdataParent> = {
>              _vptr.CbdataParent = 0x555555b78ec8 <vtable for Ftp::Gateway+520>
>            },
>            members of AsyncJob:
>            id = {
>              value = 201681648
>            },
>            stopReason = 0x0,
>            typeName = 0x555555a9355f "FtpStateData",
>            inCall = {
>              p_ = 0x5555ff888600
>            },
>            started_ = true,
>            swanSang_ = false
>          },
>          members of Adaptation::Initiator:
>          _vptr.Initiator = 0x555555b78cd8 <vtable for Ftp::Gateway+24>
>        },
>        <BodyProducer> = {
>          members of BodyProducer:
>          _vptr.BodyProducer = 0x555555b78e18 <vtable for Ftp::Gateway+344>
>        },
>        <BodyConsumer> = {
>          members of BodyConsumer:
>          _vptr.BodyConsumer = 0x555555b78e50 <vtable for Ftp::Gateway+400>
>        },
>        members of Client:
>        completed = true,
>        currentOffset = 0,
>        responseBodyBuffer = 0x0,
>        entry = 0x55555e31aaf0,
>        fwd = {
>          p_ = 0x55556c0a4748
>        },
>        request = {
>          p_ = 0x55562827ab90
>        },
>        requestBodySource = {
>          p_ = 0x0
>        },
>        requestSender = {
>          p_ = 0x0
>        },
>        virginBodyDestination = {
>          p_ = 0x0
>        },
>        adaptedHeadSource = {
>          cbc = 0x0,
>          lock = 0x0
>        },
>        adaptedBodySource = {
>          p_ = 0x0
>        },
>        adaptationAccessCheckPending = false,
>        startedAdaptation = false,
>        receivedWholeAdaptedReply = false,
>        receivedWholeRequestBody = false,
>        doneWithFwd = 0x555555a92a12 "completeForwarding()",
>        theVirginReply = 0x0,
>        theFinalReply = 0x0
>      },
>      members of Ftp::Client:
>      ctrl = {
>        <Ftp::Channel> = {
>          conn = {
>            p_ = 0x0
>          },
>          listenConn = {
>            p_ = 0x0
>          },
>          closer = {
>            p_ = 0x0
>          }
>        },
>        members of Ftp::CtrlChannel:
>        buf = 0x5556084e8f30 "221 Goodbye.\r\nsend OK.\r\ntory listing.\r\n226 Directory send OK.\r\n####\r\n220-Welcome to the HPE NimbleStorage FTP Server.\r\n220-\r\n220-Please prepend files to be uploaded with your case number\r\n220-so that "...,
>        size = 4096,
>        offset = 0,
>        message = 0x5555b1cb8b80,
>        last_command = 0x5555a99543f0 "QUIT\r\n",
>        last_reply = 0x5555bb4e65a0 "Goodbye.",
>        replycode = 221
>      },
>      data = {
>        <Ftp::Channel> = {
>          conn = {
>            p_ = 0x0
>          },
>          listenConn = {
>            p_ = 0x0
>          },
>          closer = {
>            p_ = 0x0
>          }
>        },
>        members of Ftp::DataChannel:
>        readBuf = 0x55555e493418,
>        host = 0x5555bb42a4e0 "198.54.168.47",
>        port = 6892,
>        read_pending = false
>      },
>      ftp_state_t = Ftp::Client::BEGIN,
>      state = 18,
>      old_request = 0x0,
>      old_reply = 0x0,
>      dataConnWait = {
>        <JobWaitBase> = {
>          job_ = {
>            cbc = 0x0,
>            lock = 0x0
>          },
>          callback_ = {
>            p_ = 0x0
>          }
>        },
>        members of JobWait<Comm::ConnOpener>:
>        typedJob_ = {
>          cbc = 0x55557d0ec1b8,
>          lock = 0x55557d0ec1b8
>        }
>      },
>      shortenReadTimeout = false
>    },
>    members of Ftp::Gateway:
>    user = "anonymous", '\000' <repeats 8182 times>,
>    password = "Squid@", '\000' <repeats 8185 times>,
>    password_url = 0,
>    reply_hdr = 0x0,
>    reply_hdr_state = 0,
>    clean_url = {
>      size_ = 0,
>      len_ = 0,
>      buf_ = 0x0
>    },
>    title_url = {
>      size_ = 40,
>      len_ = 35,
>      buf_ = 0x5555d58c86b0 "ftp://ftp.nimblestorage.com/upload/"
>    },
>    base_href = {
>      size_ = 40,
>      len_ = 36,
>      buf_ = 0x55559dd8c4f0 "ftp://ftp.nimblestorage.com/upload//"
>    },
>    conn_att = 0,
>    login_att = 0,
>    mdtm = -1,
>    theSize = -1,
>    pathcomps = 0x0,
>    filepath = 0x0,
>    dirpath = 0x5555e4136d90 "upload",
>    restart_offset = 0,
>    proxy_host = 0x0,
>    list_width = 0,
>    cwd_message = {
>      size_ = 40,
>      len_ = 36,
>      buf_ = 0x5555c4d14f00 "\n250 Directory successfully changed."
>    },
>    old_filepath = 0x0,
>    typecode = 0 '\000',
>    listing = {
>      <Packable> = {
>        _vptr.Packable = 0x555555b6cab0 <vtable for MemBuf+16>
>      },
>      members of MemBuf:
>      buf = 0x5555cc7050c0 "",
>      size = 0,
>      max_capacity = 2097152000,
>      capacity = 2048,
>      stolen = 0
>    },
>    flags = {
>      pasv_supported = true,
>      epsv_all_sent = false,
>      pasv_only = false,
>      pasv_failed = false,
>      authenticated = false,
>      tried_auth_anonymous = true,
>      tried_auth_nopass = false,
>      isdir = true,
>      skip_whitespace = false,
>      rest_supported = true,
>      http_header_sent = false,
>      tried_nlst = false,
>      need_base_href = false,
>      dir_slash = false,
>      root_dir = false,
>      no_dotdot = false,
>      binary = false,
>      try_slash_hack = false,
>      put = false,
>      put_mkdir = false,
>      listformat_unknown = false,
>      listing = true,
>      completed_forwarding = true
>    }
> }
> 



More information about the squid-users mailing list