@@ -44,7 +44,17 @@ pub enum PrepareError {
44
44
/// The response from the worker is received, but the file cannot be renamed (moved) to the
45
45
/// final destination location. This state is reported by the validation host (not by the
46
46
/// worker).
47
- RenameTmpFileErr ( String ) ,
47
+ RenameTmpFileErr {
48
+ err : String ,
49
+ // Unfortunately `PathBuf` doesn't implement `Encode`/`Decode`, so we do a fallible
50
+ // conversion to `Option<String>`.
51
+ src : Option < String > ,
52
+ dest : Option < String > ,
53
+ } ,
54
+ /// The response from the worker is received, but the worker cache could not be cleared. The
55
+ /// worker has to be killed to avoid jobs having access to data from other jobs. This state is
56
+ /// reported by the validation host (not by the worker).
57
+ ClearWorkerDir ( String ) ,
48
58
}
49
59
50
60
impl PrepareError {
@@ -58,7 +68,11 @@ impl PrepareError {
58
68
use PrepareError :: * ;
59
69
match self {
60
70
Prevalidation ( _) | Preparation ( _) | Panic ( _) => true ,
61
- TimedOut | IoErr ( _) | CreateTmpFileErr ( _) | RenameTmpFileErr ( _) => false ,
71
+ TimedOut |
72
+ IoErr ( _) |
73
+ CreateTmpFileErr ( _) |
74
+ RenameTmpFileErr { .. } |
75
+ ClearWorkerDir ( _) => false ,
62
76
// Can occur due to issues with the PVF, but also due to local errors.
63
77
RuntimeConstruction ( _) => false ,
64
78
}
@@ -76,7 +90,9 @@ impl fmt::Display for PrepareError {
76
90
TimedOut => write ! ( f, "prepare: timeout" ) ,
77
91
IoErr ( err) => write ! ( f, "prepare: io error while receiving response: {}" , err) ,
78
92
CreateTmpFileErr ( err) => write ! ( f, "prepare: error creating tmp file: {}" , err) ,
79
- RenameTmpFileErr ( err) => write ! ( f, "prepare: error renaming tmp file: {}" , err) ,
93
+ RenameTmpFileErr { err, src, dest } =>
94
+ write ! ( f, "prepare: error renaming tmp file ({:?} -> {:?}): {}" , src, dest, err) ,
95
+ ClearWorkerDir ( err) => write ! ( f, "prepare: error clearing worker cache: {}" , err) ,
80
96
}
81
97
}
82
98
}
@@ -89,8 +105,17 @@ impl fmt::Display for PrepareError {
89
105
pub enum InternalValidationError {
90
106
/// Some communication error occurred with the host.
91
107
HostCommunication ( String ) ,
108
+ /// Host could not create a hard link to the artifact path.
109
+ CouldNotCreateLink ( String ) ,
92
110
/// Could not find or open compiled artifact file.
93
111
CouldNotOpenFile ( String ) ,
112
+ /// Host could not clear the worker cache after a job.
113
+ CouldNotClearWorkerDir {
114
+ err : String ,
115
+ // Unfortunately `PathBuf` doesn't implement `Encode`/`Decode`, so we do a fallible
116
+ // conversion to `Option<String>`.
117
+ path : Option < String > ,
118
+ } ,
94
119
/// An error occurred in the CPU time monitor thread. Should be totally unrelated to
95
120
/// validation.
96
121
CpuTimeMonitorThread ( String ) ,
@@ -104,8 +129,18 @@ impl fmt::Display for InternalValidationError {
104
129
match self {
105
130
HostCommunication ( err) =>
106
131
write ! ( f, "validation: some communication error occurred with the host: {}" , err) ,
132
+ CouldNotCreateLink ( err) => write ! (
133
+ f,
134
+ "validation: host could not create a hard link to the artifact path: {}" ,
135
+ err
136
+ ) ,
107
137
CouldNotOpenFile ( err) =>
108
138
write ! ( f, "validation: could not find or open compiled artifact file: {}" , err) ,
139
+ CouldNotClearWorkerDir { err, path } => write ! (
140
+ f,
141
+ "validation: host could not clear the worker cache ({:?}) after a job: {}" ,
142
+ path, err
143
+ ) ,
109
144
CpuTimeMonitorThread ( err) =>
110
145
write ! ( f, "validation: an error occurred in the CPU time monitor thread: {}" , err) ,
111
146
NonDeterministicPrepareError ( err) => write ! ( f, "validation: prepare: {}" , err) ,
0 commit comments