mirror of
https://github.com/ohwgiles/laminar.git
synced 2026-11-02 08:34:44 +00:00
resolves #19: laminard crashes under load
reading into a static buffer is a race condition that is only manifested under load. There's no guarantee the clause in then() will run before another task overwrites the buffer. Allocating a local string is the only correct solution
This commit is contained in:
@@ -371,7 +371,7 @@ void Laminar::run() {
|
||||
sigaddset(&mask, SIGCHLD);
|
||||
sigprocmask(SIG_BLOCK, &mask, NULL);
|
||||
int sigchld = signalfd(-1, &mask, 0);
|
||||
srv->addDescriptor(sigchld, [this](char* buf, size_t sz){
|
||||
srv->addDescriptor(sigchld, [this](const char* buf, size_t sz){
|
||||
struct signalfd_siginfo* siginfo = (struct signalfd_siginfo*) buf;
|
||||
// TODO: re-enable assertion when the cause for its triggering
|
||||
// is discovered and solved
|
||||
@@ -505,7 +505,7 @@ std::shared_ptr<Run> Laminar::queueJob(std::string name, ParamMap params) {
|
||||
bool Laminar::stepRun(std::shared_ptr<Run> run) {
|
||||
bool complete = run->step();
|
||||
if(!complete) {
|
||||
srv->addDescriptor(run->fd, [=](char* b,size_t n){
|
||||
srv->addDescriptor(run->fd, [=](const char* b,size_t n){
|
||||
std::string s(b,n);
|
||||
run->log += s;
|
||||
for(LaminarClient* c : clients) {
|
||||
|
||||
Reference in New Issue
Block a user