Closed ahoy-jon closed 7 years ago
I will try your curl example and come back to you.
Regards, Sergei
Thanks Sergei,
I tried to understand, this test is failing on my machine (the first iteration).
package com.coldcore.akkaftp.it
package test
import java.io.{File, PrintWriter}
import com.coldcore.akkaftp.it.Utils.delay
import com.coldcore.akkaftp.it.client.{FtpClient, Reply}
import com.coldcore.akkaftp.it.server.{CreateSampleFiles, FtpServer}
import org.scalatest.{BeforeAndAfterAll, Matchers, WordSpec}
class UploadWithCurl extends WordSpec with BeforeAndAfterAll with Matchers with CreateSampleFiles {
val server = new FtpServer
"curl scenario" should {
server.start()
import scala.concurrent.duration._
createSampleFiles()
def tryUpload(): Int = {
val f = File.createTempFile("temp-file-name", ".tmp")
f.deleteOnExit()
f.createNewFile()
val path = f.getAbsolutePath
val writer = new PrintWriter(f)
writer.write("hello")
writer.close()
import sys.process._
s"curl -v -T $path ftp://127.0.0.1:2021 --user myuser:myuser" !
}
(0 to 10).map(_ -> tryUpload()) should be( (0 to 10).map(_ -> 0))
}
}
Thanks for the test case, it helped to debug the issue. After a bit of digging the code I see why it is failing. A data connection is not yet ready to accept client data. STOR command prepares the data connection but there is a delay before it gets ready. While running on the same (fast and multicore) machine the client can send the data and terminate before the data connection understands what is about to happen. The easiest fix is to delay a 150 reply to the client by 100ms: tick time of the data connection readiness check. The better solution would be a notification sent back from the data connection to the STOR command, before it sends a 150 reply to the client. I will apply the delay fix, for now.
Fixed in the “1.1” version.
Hi, I was trying your project, but the uploads are failing half of the time (and I can't really pinpoint where there could be a problem).
I use curl for the upload :
And for some reason the data connection dies.
Here is the complete error log (3 uploads, failing, success, failing), do you have any clues ?