0

I stumbled upon a very weird issue in ColdFusion which might very well be a bug, but I wanted to post it here in case I was missing something.

It seems that cfindex is throwing an uncatchable exception when trying to index invalid files.

I'm not entirely sure yet what consists of an invalid file, but the issue occurs with a valid PDF file, but that doesn't have a PDF extension. Obviously, the problem can easily be fixed by adding a valid extension, but that's not the scope of the question.

<cftry>
    <cfindex 
        collection="some_collection"
        action="update"
        key="//someserver/some_file_without_extension">

    After index

    <cfcatch type="any">
        Exception caught
    </cfcatch>

    <cffinally>
        Finally block
    </cffinally>
</cftry>

Completed

When running the above code, the only thing that is output is Finally block, therefore it's like if there is an exception thrown, but which cannot be caught.

I even tried with type="java.lang.Exception", type="java.lang.Throwable" and type="searchengine" and nothing works.

The only way I found to detect such exceptions is to check a boolean flag in the finally block, but gracefully recovering form those errors is very cumbersome.

Another very weird thing that occurs is that right after the issue is encountered, if I refresh the page in the browser, I'll get the following error:

HTTP Error 503.0 - Server Error
The service is unavailable.

Module IsapiModule 
Notification ExecuteRequestHandler 
Handler JWildCardHandler 
Error Code 0x00000000

Then after refreshing again, I get Finally block and if I keep refreshing the same behavior occurs over and over (Finally block then 503 error).

Leigh
  • 28,765
  • 10
  • 55
  • 103
plalx
  • 42,889
  • 6
  • 74
  • 90
  • Not sure about the cause, but did you check all of the log files to see if it is an `Error` or an `Exception` (not the same thing)? Based on the behavior, it sounds like an `Error`. Despite what the documentation says, [you cannot trap those with cftry/cfcatch](http://stackoverflow.com/questions/14237283/coldfusion-not-catching-noclassdeffounderror/14243560#14243560). – Leigh Feb 13 '15 at 03:44
  • @Leigh Nothing seems to show up in the exception log, but the explanation would make sense. However, what doesn't is that an `Error` is actually thrown from a cfindex tag. There's no reason calling on a Facade like cfindex should cause an unrecoverable error. If that's the case I would still consider that a bug IMO. Thanks for your input. – plalx Feb 13 '15 at 13:55
  • @Plax - Did you check all of the logs, including /runtime/logs? I do not know for certain it *is* an `Error`, just that the behavior is similar. If it is, then yes - I agree that definitely should not happen. If you find out more, and/or can create a repro case, may want to file a bug report. Sorry I could not be of more help. – Leigh Feb 13 '15 at 14:53

0 Answers0