Report server crashes when a report produces an error.
I am using Report Server 9. When a report gets called which produces error
by calculations, the report server crashes. A Range Check error is raised.
After this error, the report server produces an dialog "TRsServer - Fatal
Exception" and stops listening.
Is there any way to catch these errors?
Kind regards,
Mariella
by calculations, the report server crashes. A Range Check error is raised.
After this error, the report server produces an dialog "TRsServer - Fatal
Exception" and stops listening.
Is there any way to catch these errors?
Kind regards,
Mariella
This discussion has been closed.
Comments
-------------------------------------------------------------------------------
Tech Tip: RB Server - Exception Handling
-------------------------------------------------------------------------------
ThiS article applies to processing that occurs on the report server. It does
not apply to the webtier or client report.
The report server is a multi-threaded application. Each report executes in a
separate thread. Exceptions that descend from EReportBuilder are handled
gracefully by the server - the exception is propogated back to the web tier
or client report application. A web tier application will display an error
page, a client report application will raise an exception in the client app.
In both cases a descriptive message is included.
An exception that does not descend from EReportBuilder error is considered
fatal and will cause the server application to terminate. If ReportBuilder
Services is being used to manage the server, then ReportBuilder Services
will automatically try to restart the server application.
ReportBuilder Server contains code to check for common exceptions that occur
when loading and generating reports. These exceptions are re-raised as
either EReportBuilder or a descendant of EReportBuilder error.
Custom code that is added to the server should follow these same guidelines.
Example:
uses
ppTypes;
// define a custom exception class to use for all of your custom code
ECustomReportBuilderError = class(EReportBuilderError);
try
{some processing here}
except on E: EStreamError do
raise ECustomReportBuilderErrorr.Create(E.Message);
end;
Note: The above example will trap an EStreamError and re-raise it as
ECustomReportBuilderError. Other exceptions will be considered fatal.
Therefore you will have to decide which exceptions are acceptable and which
are fatal.
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
The exception occurs from the report itself. How can I trap these errors, as
they do not occur in custom code, but in report server and/or report builder
code?
Kind regards,
Mariella
The RB and RB Server code is structured in such a way that it traps common
errors and re-raises them as EReportBuilder error so that they can be passed
back to the client.
Any other errors in RB code would mean that the application needs to be shut
down. A properly structured report server application should not be
encountering crashes. Sounds like you might have issues with thread-safety
or some other issues.
From your description, it appears that you may be structuring your
application in a manner that has never been tested.
The report server application should be run as a stand alone .exe or within
the context of ReportBuilder Services (i.e. Windows Service). This is
described in the RB Server Developers Guide and demonstrated in the
tutorials and the RB Server Demos. Using this architecture you can
optionally run the server as a standard Delphi application using the Delphi
debugger to trace and find exceptions. Embedding the Server and WebTier in
the same application or .dll has not been tested and I would expect that it
will fail.
The WebTier has been tested within the context of ISAPI, Apache, ASP and
ASP.NET applications. These are all multi-threaded applications that all
essentially work by building a dynamically loaded module (.dll or .so) and
passing the web request/response to/from the WebTier.
report server app <----> web tier app <---> web browser
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
The exception appears only to happen in the report server, and not when
calling the same report from report builder.
I will investigate further, and let you know when I know more.
Kind regards,
Mariella
Problem appears to be in 3rd Party components which are not able to read an
empty stream. The failing reports do not exist. Our main application will
just call a "new" report in that case. Since the method to retrieve the
reports for the report server is different, the problem only occured in the
report server.
Kind regards,
Mariella
Ok great.
Another option is to write some code that retrieves the report catalog (i.e.
the directory tree of available reports) fom the server. For an example,
check out RBuilder\Demos\Clients\Dynamic List and Dynamic Menu. I'm thinking
you could retrieve the report catalog and then check whether a specified
report exists.
The WebTier.CreateClientReportCatalog method can create and configure a
TrsClientReportCatalog instance that you can use.
uses
rsWebTier,
rsWebRequest,
rsClientReportCatalog;
var
lWebRequest: TrsWebRequest;
lClientReportCatalog: TrsClientReportCatalog;
lWebRequest := myWebTier.CreateWebRequest(lQueryParams, lContent);
lClientReportCatalog := myWebTier.CreateClientReportCatalog(lWebRequest);
{call methods on client report catalog}
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
For now I will check if the stream has data, and only process it further
when its length is greather than 0. It appears to be the only problem, as
the report server did not crash anymore afterwards on non-existent reports
or broken reports.
Thanks for your input, I will see what it can do for me.
Kind regards,
Mariella