0

My web service will convert doc, text and pdf files into flash files using print2flash software, but it's working fine for approximately 2000 requests after that it is not proceesing,I'm getting operation time out error message.If I restart the machine the service is working fine for another 2000 requests. Can anyone help me what could be the reason?and how to resolve this issue?

here is my code where I'm getting the problem.

        Print2Flash3.Server2 obj = new Print2Flash3.Server2();
        Print2Flash3.BatchProcessingOptions batchProcess = new      BatchProcessingOptions();
        batchProcess.BeforePrintingTimeout = 60000;
        batchProcess.AfterPrintingTimeout = 10000;
        batchProcess.PrintingTimeout = 120000;
        batchProcess.ActivityTimeout = 30000;
        batchProcess.KillProcessIfTimeout = ThreeStateFlag.TSF_YES;
        batchProcess.ApplyChanges();



        obj.ConvertFile(inputFilename, outputFullPath, null, batchProcess, null);

This is my error log information

The User Profile Service has started successfully.

Windows Management Instrumentation Service started sucessfully

Event code: 3001 Event message: The request has been aborted. Event time: 10/31/2013 12:15:25 PM Event time (UTC): 10/31/2013 12:15:25 PM Event ID: c0911a4071c940c580fc3d75d3c36f6e Event sequence: 2826 Event occurrence: 1 Event detail code: 0 Application information: Application domain: /LM/W3SVC/1/ROOT/code-17-130276759869328000 Trust level: Full Application Virtual Path: /code Application Path: C:\inetpub\wwwroot\code\ Machine name: server Process information: Process ID: 1048 Process name: w3wp.exe Account name: server\Administrator Exception information: Exception type: HttpException Exception message: Request timed out.

Request information: 
Request URL: url
Request path: path
User host address: server
User:  
Is authenticated: False 
Authentication Type:  
Thread account name: server\Administrator    Thread information: 
Thread ID: 13 
Thread account name: server\Administrator 
Is impersonating: False 
Stack trace:

this is the error message that I'm getting continuously.

Liam
  • 27,717
  • 28
  • 128
  • 190
Lax_me
  • 307
  • 1
  • 7
  • 20
  • Show us your code, please. – Gabe Nov 01 '13 at 05:08
  • 2
    There are lots of possibilities. The two most likely (to me) are **1)** Some of your invocations to `ConvertFile` don't ever end (for some reason) and thus permanently consume a worker thread or **2)** You are running out of memory; though I'd expect a different failure case in that scenario. – Kirk Woll Nov 01 '13 at 06:19

1 Answers1

1

There are several causes to this also Kirk Woll has added some good points.

1.There might be an infinite loop which causes the service to hang Ex. exception handling method calls the same method for exception handeling. Check EventLogs in EventViewer to get these kind of error if any.

2.Memory leak, may be your application is not releasing the memory after use. Close any unwanted connection, dispose unused object after your work is done. Try any memory leak tool

Suggestion: If the above two situation fails then you can automate recycling the application pool for the service. Change Application Pool recycle settings for automatic recycle after some request

EDIT:

try the following.

 obj.ConvertFile(inputFilename, outputFullPath, null, batchProcess, null);
  //not sure if your object has similar methods or not but you can give it a try.
 obj.Close();   
 obj.Dispose();

or use the using style.

using(Print2Flash3.Server2 obj = new Print2Flash3.Server2())
  {
        Print2Flash3.BatchProcessingOptions 
        batchProcess = new        BatchProcessingOptions();
        batchProcess.BeforePrintingTimeout = 60000;
        batchProcess.AfterPrintingTimeout = 10000;
        batchProcess.PrintingTimeout = 120000;
        batchProcess.ActivityTimeout = 30000;
        batchProcess.KillProcessIfTimeout = ThreeStateFlag.TSF_YES;
        batchProcess.ApplyChanges();

        obj.ConvertFile(inputFilename, outputFullPath, null, batchProcess, null);
  }

EDIT2:

   obj.ConvertFile(inputFilename, outputFullPath, null, batchProcess, null);
   obj = null; //As the object is not disposable, you need to release the memory
               //manually.

If Print2Flash3.Server2 is a custom class then derive it from IDisposable interface and implement the Dispose method.

public class Server2 : IDisposable
  {
   ....
   ....
  public void Dispose()
  {
   this = null;
  }
 }
Community
  • 1
  • 1
sudhansu63
  • 6,025
  • 4
  • 39
  • 52
  • after recycling also I'm getting the same problem – Lax_me Nov 01 '13 at 12:47
  • Did you get anything in the EventLog ? – sudhansu63 Nov 01 '13 at 16:10
  • I've added my eventlog in the question.please find log in the question – Lax_me Nov 02 '13 at 04:32
  • 1
    When I'm trying to use using statement for my object I'm getting the following error.'Print2Flash3.Server2': type used in a using statement must be implicitly convertible to 'System.IDisposable' – Lax_me Nov 06 '13 at 06:18
  • Thanks..print2flash3 is a dll, so I cannot implement Idisposable and I assined my object to null. after that I restared machine,It takes time to know whether it is working or not.(I'll let you know tomorrow or day after tomorrow). – Lax_me Nov 06 '13 at 09:10