PDA

View Full Version : Very strange (perhaps) QHttp behaviour.



Kumosan
10th June 2008, 07:10
Hi, I have a strange problem and want to ask if someone here has an idea.

I am writing a program, which watches using the QFilesystemWatcher a watcher folder.
When another release folder is added to my watcher folder, a .torrent file is automatically created, then a mime object is created and uploaded to a tracker site using http POST.

This works perfectly well for releases of any size when I add the release folder in the watcher folder manually. However, when the folder is added via an ftp transfer, it works only for small releases (~5mb). For larger releases I have a problem, for which I have no explanation.

1. The .torrent is created correctly, so the filesystem watcher fires in case of an ftp transfer as good as when I add the files manually.

2. As far as I can tell, my mime object is also the same.

3. However, when I do a QHttp::request(<header>,<mime>,0) nothing happens. The QHttp::request returns at once, since it is non-blocking, but no transfer starts. Not a single QHttp signal is emitted. Regardless where I look, not a single trace of an executed QHttp::request can be found. Neither on the local, nor on the remote server. If I had not put debug output before and after the QHttp::request, I would have said, this method as never been called. But it has.

I am using 4.4.0 on Linux. Any ideas? Anyone experienced something similar?

wysota
10th June 2008, 07:33
Maybe the file has not yet complete writing itself and hence cannot be opened for reading and thus QHttp fails?

Kumosan
10th June 2008, 07:58
Maybe the file has not yet complete writing itself and hence cannot be opened for reading and thus QHttp fails?

Very unlikely. When I experimented with mime and POST I made several mistakes before I figured out how this worked. I always got more or less comprehensible error responses from the site I contacted. It happened not even once that a request was just 'swallowed'.

Furthermore the .torrent is created and can be uploaded manually. So the release was complete. The .torrent creation is a synchronous process. No way that I start creating the mime object before the .torrent creation is completed.

The whole behaviour is strange.

wysota
10th June 2008, 08:53
Could you prepare a minimal compilable example reproducing the problem?

Kumosan
10th June 2008, 08:58
Could you prepare a minimal compilable example reproducing the problem?

Nope, this would be the whole program. And I cannot release this to the public. But even if I could, it would be quite an effort to reproduce the necessary running environment.

Actually I did not expect direct debug help, this is more or less impossible. I just hoped someone experienced a similar problem or might have an idea where to look.

Kumosan
11th June 2008, 07:03
Little update. I was able to locate the problem. It is not QHttp. It is the QFileSystemWatcher. When I move the files manually, I get the expected number of signals fired. When the files are added using ftp transfer, it somehow enters an endless loop. Even when the transfer is long finished, nobody touches anything in the watched folder, I get a very fast and constant stream of directoryChanged( const QString & path ) signals.

Not nice, but to find a workaround is easy.