Skip to content

Commit

Permalink
Fix potential crash on unjoined parser thread (#4537)
Browse files Browse the repository at this point in the history
  • Loading branch information
peterychang authored Apr 3, 2023
1 parent a9b305f commit a76d9f0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion vowpalwabbit/cli/src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "vw/core/learner.h"
#include "vw/core/memory.h"
#include "vw/core/parse_primitives.h"
#include "vw/core/scope_exit.h"
#include "vw/core/vw.h"
#include "vw/io/logger.h"

Expand Down Expand Up @@ -104,6 +105,8 @@ int main(int argc, char* argv[])
else
{
VW::start_parser(all);
auto scope_guard = VW::scope_exit([&all] { VW::end_parser(all); });

if (alls.size() == 1) { VW::LEARNER::generic_driver(all); }
else
{
Expand All @@ -112,7 +115,6 @@ int main(int argc, char* argv[])
for (auto& v : alls) { alls_ptrs.push_back(v.get()); }
VW::LEARNER::generic_driver(alls_ptrs);
}
VW::end_parser(all);
}

for (auto& v : alls)
Expand Down

0 comments on commit a76d9f0

Please sign in to comment.