Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use released pipeline pointer #1978

Merged
merged 2 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion core/runner/ProcessorRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ void ProcessorRunner::Run(uint32_t threadNo) {
sInGroupDataSizeBytes->Add(item->mEventGroup.DataSize());

shared_ptr<Pipeline>& pipeline = item->mPipeline;
if (!pipeline) {
bool hasOldPipeline = pipeline != nullptr;
if (!hasOldPipeline) {
pipeline = PipelineManager::GetInstance()->FindConfigByName(configName);
}
if (!pipeline) {
Expand All @@ -139,6 +140,16 @@ void ProcessorRunner::Run(uint32_t threadNo) {
vector<PipelineEventGroup> eventGroupList;
eventGroupList.emplace_back(std::move(item->mEventGroup));
pipeline->Process(eventGroupList, item->mInputIndex);
// if the pipeline is updated, the pointer will be released, so we need to update it to the new pipeline
if (hasOldPipeline) {
pipeline = PipelineManager::GetInstance()->FindConfigByName(configName);
if (!pipeline) {
LOG_INFO(sLogger,
("pipeline not found during processing, perhaps due to config deletion",
"discard data")("config", configName));
continue;
}
}
Abingcbc marked this conversation as resolved.
Show resolved Hide resolved

if (pipeline->IsFlushingThroughGoPipeline()) {
// TODO:
Expand Down
1 change: 1 addition & 0 deletions core/runner/sink/http/HttpSink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ void HttpSink::HandleCompletedRequests(int& runningHandlers) {
CURL* handler = msg->easy_handle;
HttpSinkRequest* request = nullptr;
curl_easy_getinfo(handler, CURLINFO_PRIVATE, &request);
auto pipelinePlaceHolder = request->mItem->mPipeline; // keep pipeline alive
auto responseTime = chrono::system_clock::now() - request->mLastSendTime;
auto responseTimeMs = chrono::duration_cast<chrono::milliseconds>(responseTime).count();
switch (msg->data.result) {
Expand Down
Loading