Crystal Report License - Multiple Thread Safe?

I

ian_jacobsen

First let me start by saying that this problem is not consistently
reproducible. I have a windows service that creates reports for a
group of entities. This service can process multiple groups at a
single time, where each group is running in a separate thread. I have
noticed mixed behavior when running multiple groups at one time (in
separate threads). I have received the following two messages logged
as errors.

- A Crystal Reports job was delayed 2 second waiting for a free license
to become available. More licenses can be purchased direct from Crystal
Decisions or through the Crystal Decisions Online Store.

- A Crystal Reports job failed because a free license could not be
obtained in the time allocated. More licenses can be purchased direct
from Crystal Decisions or through the Crystal Decisions Online Store.

This is unique to running multiple threads simultaneously, and does not
occur if one group is processed followed by the next group in
sequential order. In addition, this does not occur every time that I
run the test.

My thought is that there is one license that is being passed around and
that only a single thread can have it at any given time. For example
if I have 4 threads that are running, and producing reports. The first
obtains the license, does its job, and drops the license. Now the
second (or any other for that matter) obtains the license, does its
job, and drops the license. However since these all threads could
potentially be requesting the license at a single point in time, this
could cause an undesired affect. If thread 1 obtains the license, and
thread 2 is waiting for it. As thread 1 releases the license, thread 3
obtains it, thread 2 is still left waiting. A few more cycles like
this, and all of a sudden thread 2 will timeout. Am I wrong in
thinking that there might be a race condition with the license and
multiple threads? Is Crystal Reports thread safe?

I'm using the Crystal Reports that is integrated with Visual Studio
2003, find the versions below.

Microsoft Development Environment 2003 Version 7.1.3088
Microsoft .NET Framework 1.1 Version 1.1.4322 SP1
Crystal Reports for Visual Studio .NET AAP50-GS00000-U7000RN

Any thoughts?

--ian
 
T

ttirella

The Crystal Reports that is included with VS.Net 2003 only supports one
concurrent thread for report generation. I've run into this problem
also. My solution was to create my own system of checking whether
there was an available license and queue the other requests. There's a
static function called something like 'GetCurrentLicenses' that's
contained in the 'ReportDocument' class, and maybe elsewhere. You can
check the integer it returns to see how many licenses are available.
AFAIK crystal doesn't do anything special to wait for a license, it
just throws an exception.

FYI: In my solution I created a high priority and low priority queue in
case the waits got long and something important was waiting (e.g. a
scheduled report would be in the low queue and a user requested report
in the high queue).
 
I

ian_jacobsen

Thanks. That was my guess, but it's nice to get confirmation. It's
sad that we have to jump through hoops and provide our own semaphore to
handle report generation from multiple threads.

--ian
 
T

Terence Tirella

Yeah, I think the real answer is that Crystal wants the .Net/COM
objects to be a launch pad into a full fledged crystal enterprise
server installation. Which is why they limit the licensing so much.
It will be interesting to see if/how this changes now that MS Reporting
Services is on the market and maturing.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top