Hi guys, I'm having a little complicated problem here...

The main task of my software is do some complex operations on big lists.
For managing the operations I'm using NSOperationQueue, so I'm limiting to 5
operations at once (these operations use a lot of HTTP connections).

So, since I wanna have better control of them, to make it easy I'm using
only synchronous requests, it all seems to working nice, before I'm start
uploading things with multipart...

To do the multipart I wrote my own code for it, can be found here (its
really simple):
https://github.com/wilkerlucio/cocoa_simple_multipart/blob/master/NSMutableURLRequest+MultipartBody.m

I'm using GC, this is why there isn't any memory management there...

The problem is, after doing like 10 uploads (it vary) the response code from
the server starts being 500... In my case it means that the
max simultaneous connections was reached, so I start trying again when it
happens, but it takes a lot of retries (between 10 and 40) to be able to
work again... But if I restart the program, all the first are working on
first try, it seems that the upload connections are being retained after I
finish it, so, the connections are alive, blocking new ones...

The code that fetches the upload is basically this:

    NSMutableURLRequest *request = [SubdbSource createRequest:@"upload"
withOptions:[NSDictionary dictionaryWithObject:hash forKey:@"hash"]];

    [request setHTTPMethod:@"POST"];

    [request addMultipartDataToBody:subtitleData fieldName:@"file" fileName:
@"content.str" contentType:@"application/octet-stream"];

    NSHTTPURLResponse *response;



    NSData *data = [NSURLConnection sendSynchronousRequest:request
returningResponse:&response error:err];



    if (data) {

        return [response statusCode];

    } else {

        return 0;

    }

I retrieve the data, but in this case I use the data just to see if
connection returned valid information (what is relevant to me is only the
response code), but these connections seems to not be closing...

Any ideas on how to fix that? I tried do some analysis but I got no luck...
Anyone has any idea of what could be happening?
---
Wilker LĂșcio
http://about.me/wilkerlucio/bio
Kajabi Consultant
+55 81 82556600
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to