Skip to content

Commit

Permalink
fix crash with depend verbose + rare crashes in presence of lot of er…
Browse files Browse the repository at this point in the history
…rors
  • Loading branch information
cesar-douady committed May 2, 2024
1 parent 48cd4a3 commit 1a94c9c
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/autodep/record.hh
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private :
else return IMsgBuf().receive<JobExecRpcReply>(report_fd()) ;
}
//
void _report_access( JobExecRpcReq&& jerr ) const ;
void _report_access( JobExecRpcReq&& jerr ) const ;
void _report_access( ::string&& f , FileInfo fi , Accesses a , bool write , ::string&& c={} ) const {
_report_access({ Proc::Access , {{::move(f),fi}} , {.write=Maybe&write,.accesses=a} , ::move(c) }) ;
}
Expand Down
6 changes: 4 additions & 2 deletions src/lmakeserver/codec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,10 @@ namespace Codec {
case JobMngtProc::Decode : jmrr = cc.decode() ; break ;
case JobMngtProc::Encode : jmrr = cc.encode() ; break ;
DF}
jmrr.fd = cc.fd ; // seq_id will be filled in by send_reply
Backends::send_reply( cc.job , ::move(jmrr) ) ;
if (cc.fd) {
jmrr.fd = cc.fd ; // seq_id will be filled in by send_reply
Backends::send_reply( cc.job , ::move(jmrr) ) ;
}
}

}
4 changes: 4 additions & 0 deletions src/lmakeserver/job.cc
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,10 @@ namespace Engine {
}
Run :
trace("run",pre_reason,ri,run_status) ;
if ( ri.state.missing_dsk) {
ri.reset() ;
goto RestartAnalysis ;
}
SWEAR(!ri.state.missing_dsk) ; // cant run if we are missing some deps on disk
if (rule->n_submits) {
if (ri.n_submits>=rule->n_submits) {
Expand Down
2 changes: 1 addition & 1 deletion src/lmakeserver/job.x.hh
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ namespace Engine {
private :
Step _step:3 = {} ; // 3 bits
} ;
static_assert(sizeof(JobReqInfo)==48) ; // check expected size XXX : optimize size, can be 32
static_assert(sizeof(JobReqInfo)==48) ; // check expected size, XXX : optimize size, can be 32

}

Expand Down
10 changes: 6 additions & 4 deletions src/lmakeserver/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -376,10 +376,12 @@ bool/*interrupted*/ engine_loop() {
::vector<Dep> deps ; deps.reserve(ecjm.deps.size()) ;
for( auto const& [dn,dd] : ecjm.deps ) deps.emplace_back(Node(dn),dd) ;
JobMngtRpcReply jmrr = je.job_info(ecjm.proc,deps) ;
jmrr.fd = ecjm.fd ; // seq_id will be filled in by send_reply
//vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
Backends::send_reply( +je , ::move(jmrr) ) ;
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
if (+ecjm.fd) {
jmrr.fd = ecjm.fd ; // seq_id will be filled in by send_reply
//vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
Backends::send_reply( +je , ::move(jmrr) ) ;
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
}
} break ;
DF}
} break ;
Expand Down
2 changes: 1 addition & 1 deletion src/lmakeserver/node.x.hh
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ namespace Engine {
DepsIter& operator++(int) { return ++*this ; }
DepsIter& operator++( ) {
if (i_chunk<hdr->hdr.sz) i_chunk++ ; // go to next item in chunk
else { i_chunk = 0 ; hdr = hdr->next() ; } // go to next chunk }
else { i_chunk = 0 ; hdr = hdr->next() ; } // go to next chunk
return *this ;
}
// data
Expand Down
2 changes: 1 addition & 1 deletion src/rpc_job.cc
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ ::ostream& operator<<( ::ostream& os , JobMngtRpcReq const& jmrr ) {
return os <<')' ;
}

JobMngtRpcReq::JobMngtRpcReq( SI si , JI j , Fd fd_ , JobExecRpcReq&& jerr ) : seq_id{si} , job{j} , fd{fd_} {
JobMngtRpcReq::JobMngtRpcReq( SI si , JI j , Fd fd_ , JobExecRpcReq&& jerr ) : seq_id{si} , job{j} , fd{jerr.sync?fd_:Fd()} {
switch (jerr.proc) {
case JobExecProc::Decode : proc = P::Decode ; ctx = ::move(jerr.ctx) ; file = ::move(jerr.files[0].first) ; txt = ::move(jerr.txt) ; break ;
case JobExecProc::Encode : proc = P::Encode ; ctx = ::move(jerr.ctx) ; file = ::move(jerr.files[0].first) ; txt = ::move(jerr.txt) ; min_len = jerr.min_len ; break ;
Expand Down

0 comments on commit 1a94c9c

Please sign in to comment.