Open ybitso opened 8 years ago
I rewrote that file form scratch and didnt get an error, but now working on another file and getting that same error
doit('http:\\www.something.com\getthisfile.zip','c:\\helloworld.zip')
function doit(url,localfile) {
async.waterfall([
function(callback) { //download file
//### if i do console.log here, this line outputs ##Before error
if (url) {
var file = fs.createWriteStream(localpath + localfile);
http.get({
url: url,
binary: true
}, function (err, res){
if(err) {
console.error(err);
console.log('Error in Download')
callback(null)
}
else {
file.write(res.body);
file.end(function () {
//### if i do console.log here, this line outputs ##After error
callback(null)
})
}
});
}
else {
console.log('Bad URL')
callback(null)
//### if i do console.log here, this line outputs ##After error
}
//### if i do console.log here, this line outputs ##Before error
},
function (callback){
//### if i do console.log here, this line outputs ##After error
//some processing
}], function (error, results) { //done
//####never gets here
});
}
I don't know the cause of this, but the fix is to blow away your logs directory. Per what you indicated, it's likely because something was written incorrectly. It's known that calling fs.write multiple times on the same file without waiting for the callback is unsafe; I assume the scribe writes are non-blocking, so that may be the issue, that multiple calls to log aren't properly serialized, leading to writes clobbering each other, leading to corrupted existing logs, which breaks scribe on startup.
Hello,
I'm facing the same problem, if the server crash for any reason the file is corrupted and the only solution that i have found is to dlete the logs folder. Is there a fix or roundabout for this?
Thanks in advance
Dev branch has a new build using a mongodb backing. perhaps that might be of use
I get the error of
from commandline i run
which is
runtest.js is simply:
If i put process.exit() outside, everything works Any operation\method\async that I run, it throws the error, but data will still complete
It was working fine last week (on different files, havent tested them again because they are in production. I upgraded my dev of node to 4.1.1 and removed\installed clean scribe and scribe-js
when looking at logWriter.js:81, I added a console.log(data) and the output is not in correct JSON format
Notice the last line, it has an extra: