Welcome to LEAD Support Forum Login | Register | Faq  

    LEAD Support Forum
  Resource to find answers and post technical questions about LEAD products.
Search    
   

Re: "Redirecting Already" error in single-thread RMI service
Started by akirapix at 06-25-2008 8:17. Topic has 7 replies.

Print Search « Previous Thread Next Thread »
  06-25-2008, 8:17
akirapix is not online. Last active: 6/25/2008 8:57:50 AM akirapix

Not Ranked
Joined on 06-25-2008
Posts 4
"Redirecting Already" error in single-thread RMI service
Reply Quote
Hello,
i made a rmi service that takes some tiff  images and creates a multitiff image. Sometime i get a strange Redirecting Already. What does this error means?
Ho can i solve it? This is the code:

public byte[] generaMultiTIFF(ImageFile[] immagini) {

            MemoryStream risultato = new MemoryStream();
            MemoryStream memStream = null;
            Image swapImage = null;
            RasterImage raster = null;

            try {

                foreach (ImageFile imm in immagini) {

                    memStream = new MemoryStream(imm.Stream);
                    swapImage = Image.FromStream(memStream);
                    raster = new RasterImage(swapImage);

                    this._rasterCodecs.Save(
                        raster
                        , risultato
                        , RasterImageFormat.TifLzw
                        , 1 /*bitsPerPixel*/
                        , 1 /*firstPage*/
                        , 1 /*lastPage*/
                        , 0
                        , CodecsSavePageMode.Append);


                    memStream.Close();
                    swapImage.Dispose();

                }

            } catch (Exception exc) {

                this._service.EventLog.WriteEntry(
                    SharedFunctions.getErrorMessage(exc));            
            }
                        
            return risultato.ToArray();        
        }
   Report 
  06-25-2008, 11:38
GregR is not online. Last active: 11/17/2008 11:10:19 AM GregR



Top 10 Posts
Joined on 05-31-2006
In House
Posts 1,706
Re: "Redirecting Already" error in single-thread RMI service
Reply Quote
What is the file version of Leadtools.dll that you are using?

Which function is throwing the "Redirecting Already" exception? 

I've never heard of this exception before.  Is this a Leadtools Exception or a Windows Exception?  I can't find anything like it in our documentation.

I did notice one thing in your code though.  Your call to Image.FromStream and then using the RasterImage constructor is a little bit of a roundabout way to load the image from memory.  The RasterCodecs.Load function has several overloads which can use a Stream object.  I believe that this would give a small performance increase to your code.

Greg Ross
LEADTOOLS Technical Support
   Report 
  06-26-2008, 4:01
akirapix is not online. Last active: 6/25/2008 8:57:50 AM akirapix

Not Ranked
Joined on 06-25-2008
Posts 4
Re: "Redirecting Already" error in single-thread RMI service
Reply Quote
Hello,
the leadtools.dll i am using is'15.0.0.27'. I posted in this forum for two reasons:
1) I searched throught MSD library for this error and i found nothing.
2) I searched throught leadtools forum and i found another post (without any answers) talking about this error.
I'm not sure that the problem is caused by leadtools libraries but as you can see from the code i posted, there is not much code to examine. I was thinking that the problem was caused by RasterCodecs.Save().
Can you help me please?

   Report 
  06-26-2008, 8:44
GregR is not online. Last active: 11/17/2008 11:10:19 AM GregR



Top 10 Posts
Joined on 05-31-2006
In House
Posts 1,706
Re: "Redirecting Already" error in single-thread RMI service
Reply Quote
That is an older version of the v15 SDK.  I'd like for you to download the latest patch to see if that solves the problem.  Please send an email to support@leadtools.com in order to get the download instructions for the latest patch.  For verification purposes, I need you to include the following information:
 
1. The company you work for
2. The LEADTOOLS serial number(s) you own (if you are evaluating, just say so and we'll send you the eval patch)
3. The name(s) of the developer(s) using the serial number
4. A link to this forum post

Looking at the code I cannot tell what might cause that error.  If the problem persists in the latest version of the SDK, please send a small sample project (NOT your entire application) that isolates the problem so I can try to reproduce it here.

NOTE: If you are attaching a project or file to the forums...
1.) Zip the file(s) up.
2.) Make sure it is less than 5 MB.  If it is larger, please send an email to support@leadtools.com and we'll send you FTP instructions.
3.) Remove ANY AND ALL unlock codes and LEADTOOLS DLLs.
4.) Do not click the preview button, the attachment will not show up when you post it.
 
If you do not wish to post your file(s) on the forum since they are publically viewable, please send an email to support@leadtools.com and make sure that you include a link to this forum post.


Greg Ross
LEADTOOLS Technical Support
   Report 
  06-27-2008, 10:12
akirapix is not online. Last active: 6/25/2008 8:57:50 AM akirapix

Not Ranked
Joined on 06-25-2008
Posts 4
Re: "Redirecting Already" error in single-thread RMI service
Reply Quote
I think it is not really caused by your dll. RasterCodecs.Save() is included in an object shared as an RMI service. The rastercodecs object is NOT declared as static and it is shared by other objects that perform image manipulation and save. I was looking in MSDN library and now i have a doubt. The piece of code i wrote is called by many clients with as RMI service call.
I think that the problem is that RasterCodecs object is not declared as static and, because a lot of clients use it, there is some kind of 'overlapping'.
Did you ever encountered a problem like this?

   Report 
  06-27-2008, 14:38
GregR is not online. Last active: 11/17/2008 11:10:19 AM GregR



Top 10 Posts
Joined on 05-31-2006
In House
Posts 1,706
Re: "Redirecting Already" error in single-thread RMI service
Reply Quote
Unfortunately, I've never encountered anything like this.

Did you try the latest dlls?

If this application is single-threaded as your title suggests, I'm not sure if overlapping could be a problem.  Either way, our SDK should be thread-safe.  If a new instance (process) of the application is made for each client, there shouldn't be any kind of overlapping problem either because the DLLs get loaded into memory by the process. 

Does this problem only occur when many clients are using it at the same time or are you able to reproduce it with only one client?

Would it be possible to send a small sample project that isolates this problem?

Greg Ross
LEADTOOLS Technical Support
   Report 
  06-30-2008, 6:57
akirapix is not online. Last active: 6/25/2008 8:57:50 AM akirapix

Not Ranked
Joined on 06-25-2008
Posts 4
Re: "Redirecting Already" error in single-thread RMI service
Reply Quote
Hi,
i tryed to declare a new RasterCodecs object each time i need to call Save() function instead of creating only one instance and pass it to the function that needs Save() method and now it works. Maybe RasterCodecs is not thread safe?

   Report 
  06-30-2008, 9:27
GregR is not online. Last active: 11/17/2008 11:10:19 AM GregR



Top 10 Posts
Joined on 05-31-2006
In House
Posts 1,706
Re: "Redirecting Already" error in single-thread RMI service
Reply Quote
The RasterCodecs object is thread safe with a small number of exceptions such as loading PDF files are not due to the third-party engine we are using is not thread-safe.

Anyways, you said in your title that this is a single-thread service, so I'm doubtful that this is the case (unless the application is actually multi-threaded). 

Greg Ross
LEADTOOLS Technical Support
   Report 
Post
LEAD Support Fo... » Developer » Image Compressi... » Re: "Redirecting Already" error in single-thread RMI service

Powered by Community Server, by Telligent Systems