When a new vector is added larger than then current vector capacity,
it reallocates space. lamda function accesses the previous adress will
cause a segment fault. Therefore, reserve sufficient funcs space to
avoid reallocation.
Fixes: https://tracker.ceph.com/issues/52907
Signed-off-by: Chunsong Feng <fengchunsong@huawei.com>
}
public:
- explicit DPDKStack(CephContext *cct): NetworkStack(cct)
- {}
+ explicit DPDKStack(CephContext *cct): NetworkStack(cct) {
+ funcs.reserve(cct->_conf->ms_async_op_threads);
+ }
virtual bool support_local_listen_table() const override { return true; }
virtual void spawn_worker(std::function<void ()> &&func) override;