[E2010SP3] [EWS2.0] [C#][Windows] - Multi-threaded EWS App is encountering ArgumentOutOfRange - Count cannot be less then zero

Hi,
       I have a multi-threaded EWS app that is pushing email, appointments, and contacts to Exchange2010SP3. Each thread is using a separate instance ExchangeService and is working with a different mailbox on each thread. We are seeing that
when 4 or more threads are running we are starting to see ArgumentOutOfRange [Count cannot be less then zero] exceptions in the EWS library. These errors appear to be happening sporadically.
Here is an example of one of stack traces:
Stack Trace -- 
at System.String.CopyTo(Int32 sourceIndex, Char[] destination, Int32 destinationIndex, Int32 count) 
at System.IO.StreamWriter.Write(String value) 
at System.IO.TextWriter.SyncTextWriter.Write(String value) 
at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.BuildEwsHttpWebRequest() 
at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ValidateAndEmitRequest(IEwsHttpWebRequest& request) 
at Microsoft.Exchange.WebServices.Data.ExchangeService.InternalBindToItems(IEnumerable`1 itemIds, PropertySet propertySet, ServiceErrorHandling errorHandling) at Microsoft.Exchange.WebServices.Data.ExchangeService.BindToItem[TItem](ItemId itemId, PropertySet
propertySet) at Quest.Apollo.MigrationProviders.Interfaces.GenericRetryAction.InternalRetry[T](RetryMethod`1 retryMethod) in c:\Builds\272\Apollo\1.6.0 Nightly\Sources\Apollo.MigrationProviders.Interfaces\GenericRetryAction.cs:line 111 at Quest.Apollo.MigrationProviders.Interfaces.GenericRetryAction.Retry[T](RetryMethod`1
retryMethod, Boolean disableRetry) in c:\Builds\272\Apollo\1.6.0 Nightly\Sources\Apollo.MigrationProviders.Interfaces\GenericRetryAction.cs:line 135 
These exceptions are occurring on various EWS operations, but mostly on FindItems and Bind operations. They only seem to occur against Exchange 2010 servers at least that's what I've seen so far. These issues appear to resemble some kind of race condition.
I did some searches on EWS, Race Condition, SyncTextWriter and I came across an interesting issue while searching on SyncTextWriter and Race Condition. I'm curious if this is what is causing this error to occur in the EWS library:
http://connect.microsoft.com/VisualStudio/feedback/details/249253/synchronized-textwriter-not-synchronizing-properly
 The post indicates that SyncTextWriter was only designed to synchronize multiple threads against the same instance and that it was not designed to synchronize multiple threads against multiple instances SyncTextWriter. I've noticed that in all instances
of this error I've seen the stack traces always end up inside of SyncTextWriter. Is this a bug in the EWS libraries use of SyncTextWriter? Note: the above article does post workarounds for this issue. Can't tell if the EWS library is using any of these workarounds
or is avoiding this issue in some other way.
I know Microsoft doesn't claim that the EWS library is thread safe. However, I've seen many posts that seem to indicate that if a separate instances of the exchange service are used for each thread it works fine. Futhermore, we've run this app many times against
Office 365 and haven't seen this issue. It appears to only happen against Exchange 2010, but that maybe due to better throughput to the Exchange 2010 server compared to the Office 365 servers. Any help or insight would be greatly appreciated.
             Thanks,
                  Steve
 

Hi,
Found a note explaining the significance of these errors.
It says:
"NZE-28862: SSL connection failed
Cause: This error occurred because the peer closed the connection.
Action: Enable Oracle Net tracing on both sides and examine the trace output. Contact Oracle Customer support with the trace output."
For further details you may refer the Note: 244527.1 - Explanation of "SSL call to NZ function nzos_Handshake failed" error codes
Thanks & Regards,
Sindhiya V.

Similar Messages

  • Cannot get bitmap from native DLL from multi threaded Java app.

    I have a native DLL that gives me a HBITMAP (Windows handle to bitmap). I have made a JNI wrapper for this that gives me a BufferedImage back. The native code simple gets the actual bitmap for the handle, converts the RGB byte triplets to RGB ints, puts this in a jintArray and creates a BufferedImage.
    This all works fine within a single Java thread. If I do this multi threaded (thread 1 calls the native function and several seconds later, thread 2 calls the native function) I keep getting the last image of the first thread. Can enyone help me out?
    I know that this is probably a question for MSDN but I just know that they will tell me its a JNI question.
    The native code:
    JNIEXPORT jobject JNICALL Java_somenamespace_getPicture
    (JNIEnv *env, jclass cl, jstring serialNumber)
    jobject jImage;
    jclass jImageClass;
    jmethodID jMethod;
    jfieldID jField;
    jintArray rgbArray;
    char *str;
    char *charArray;
    int *intArray;
    int w, h, index, type;
    HBITMAP hbmp;
    BITMAP bmp;
    str = (char*)((*env)->GetStringUTFChars(env, serialNumber, NULL));
    // Gets the HBITMAP handle from the native DLL. The first argument is to select the device, based on serial number.
    getPicture(str, &hbmp);
    (*env)->ReleaseStringUTFChars(env, serialNumber, str);
    // Get the BITMAP for the HBITMAP
    GetObject(hbmp, sizeof(BITMAP), &bmp);
    // Create my BufferedImage
    jImageClass = (*env)->FindClass(env, "java/awt/image/BufferedImage");
    jMethod = (*env)->GetMethodID(env, jImageClass, "<init>", "(III)V");
    jField = (*env)->GetStaticFieldID(env, jImageClass, "TYPE_INT_RGB", "I");
    type = (*env)->GetStaticIntField(env, jImageClass, jField);
    jImage = (*env)->NewObject(env, jImageClass, jMethod, bmp.bmWidth, bmp.bmHeight, type);
    // Get the RGB byte triplets of the BITMAP
    charArray = (char *)malloc(sizeof(char) * bmp.bmHeight * bmp.bmWidth * 3);
    GetBitmapBits(hbmp, sizeof(char) * bmp.bmHeight * bmp.bmWidth * 3, charArray);
    // Allocate space to store the RGB ints and convert the RGB byte triplets to RGB ints
    intArray = (int *)malloc(sizeof(int) * bmp.bmHeight * bmp.bmWidth);
    index = 0;
    for (h = 0; h < bmp.bmHeight; ++h)
    for (w = 0; w < bmp.bmWidth; ++w)
    int b = *(charArray + index * 3) & 0xFF;
    int g = *(charArray + index * 3 + 1) & 0xFF;
    int r = *(charArray + index * 3 + 2) & 0xFF;
    *(intArray + index) = 0xFF000000 | (r << 16) | (g << 8) | b;
    ++index;
    // Create a jintArray for the C RGB ints
    rgbArray = (*env)->NewIntArray(env, bmp.bmHeight * bmp.bmWidth);
    (*env)->SetIntArrayRegion(env, rgbArray, 0, bmp.bmHeight * bmp.bmWidth, (jint*)intArray);
    // Use BufferedImage.setRGB() to fill the image
    jMethod = (*env)->GetMethodID(env, jImageClass, "setRGB", "(IIII[III)V");
    (*env)->CallVoidMethod(env, jImage, jMethod,
    0, // int startX
    0, // int startY
    bmp.bmWidth, // int width
    bmp.bmHeight, // int height
    rgbArray, // int[] rgbArray
    0, // int offset
    bmp.bmWidth); // int scansize
    // Free stuff
    (*env)->DeleteLocalRef(env, rgbArray);
    free(charArray);
    free(intArray);
    return jImage;
    }I already tried working with native HDCs (GetDC, CreateCompatibleBitmap, SelectObject, GetDIBits, ...) but this just complicates stuff and gives me the same result.

    Have you verified what the "native DLL" gives you back on the second call?The HBITMAP handle returned is the same each call (no matter which thread). The actual BITMAP associated with this handle is only updated in the first thread.
    How are you determining that the image is the same?If I point the camera (I don't get a stream, I just get individual images) to a moving scene, I get different images for each call from within the first thread. The second thread only gets the latest image from the first thread. There is no concurrency of the threads and all methods are synchronized.
    Specifically did you verify that the problem is not that your test code itself is using the same instance?Yes, I tested the native side as well as the Java side. The BufferedImage is always an exact copy of the native BITMAP.
    Try printing out the hash for each instance.I have written the image to a file in the native code itself to eliminate anything related to the mechanism of returning the BufferedImage. This had the same result.
    The return values of all native calls all indicate successful calls.
    I am suspecting the native side of creating a second graphical context for the second thread while it keeps refering to the first context.
    (I will start a thread on the MSDN as well and will post here if anything turns up.)

  • LabVIEW built DLL's in a multi-threaded C++ app, Help Needed!

    I'm working on a software application that is being developed
    primarily in C++. There is a component of this larger application,
    however, that is being developed in LabVIEW (for several reasons that
    I won't dive into here). This LabVIEW code is therefore executed
    within a C++ wrapper class that calls a LabVIEW built DLL.
    All this was fine and dandy, untill we decided to multi-thread our C++
    application. As a result, the LabVIEW DLL now gets called from
    multiple threads simultaneously. From all of my testing, it appears
    that resource locking is occuring such that only one thread has access
    to the .dll at a time. If I make the .vi used to define the dll
    function prototype as non-reentrant then this is what we see. As an
    example, say we have 3 threads all calling the same .dll method call.
    Thread 1, 2, and 3 all call the .dll within a few milliseconds of each
    other. Thread 1 completes the .dll call after X milliseconds. Thread 2
    completes the .dll call after 2X milliseconds, and thread 3 completes
    after 3x milliseconds.
    Now, changing the vi to reentrant, and running the same test, we see
    Thread 1, 2, and 3 all complete the .dll call in 3x milliseconds.
    While the fact that they now take the same amount of time to complete
    would lead you to believe they are happening in parallel, the fact
    that it takes 3x milliseconds as opposed to X milliseconds means they
    are not.
    Has anyone ever dealt with these issues before? Is it possible that
    messing with the "execution system" for the vi will have an affect?
    What if different .dll methods but still attached to the same .dll are
    called from different threads? Same behavior? Is it a lost cause? Is
    there no way to make code within a single LabVIEW built .dll run in
    two different threads at the same? From what I understand this is
    easily doable with a normal (non-LV built) .dll.
    Please, if anyone has any advice in this area, let me know!!!
    Much appreciated,
    Jesse Hurdus

    Duplicate post.

  • Force a multi-threaded client to use more than one proxy.

    I have a multi-threaded client app. that I'm using to test our proxy throughput. I've run into the same problem I've seen other people run into where the client application threads all get sent via the same proxy (in my case, I have 16 proxies available and configured in the client config.)
    Now I've seen threads like this one: Re: How to dynamically connect Extend client to proxy server?
    I just wondered, has a solution appeared since that time? I guess Coherence 3.6 and 3.7 have appeared in the interim. I'm on 3.6.1.4.
    My "Coherence specific" code is all localised in each thread and nothing is shared, so I guess the behaviour I'm seeing is something to do with the way Coherence initialises it's client classes within the JVM, rather than something it defers until a cache connection is established.
    Any solutions to this problem, so I can get my multi-threaded client (where each thread opens a NamedCache connection and then establishes a CQC against it) to use all (or at least more) of the available 16 proxies?
    Cheers,
    Steve

    I have a multi-threaded client app. that I'm using to test our proxy throughput. I've run into the same problem I've seen other people run into where the client application threads all get sent via the same proxy (in my case, I have 16 proxies available and configured in the client config.)
    Now I've seen threads like this one: Re: How to dynamically connect Extend client to proxy server?
    I just wondered, has a solution appeared since that time? I guess Coherence 3.6 and 3.7 have appeared in the interim. I'm on 3.6.1.4.
    My "Coherence specific" code is all localised in each thread and nothing is shared, so I guess the behaviour I'm seeing is something to do with the way Coherence initialises it's client classes within the JVM, rather than something it defers until a cache connection is established.
    Any solutions to this problem, so I can get my multi-threaded client (where each thread opens a NamedCache connection and then establishes a CQC against it) to use all (or at least more) of the available 16 proxies?
    Cheers,
    Steve

  • Multi-thread failure - Error in assignment

    Hello
    I have a c++ program processor running under Windows XP with Oracle 9i. My program access to oracle by an ODBC driver version 9.2.0.4.0. It could be launched in multi-thread to increase performance. When I launch it with one thread everything is fine. When I use several threads I have problems. ODBC driver returns to me a "error in assignment ... General error" message and my updates queries failed. Under SQl server it works without problems. It seems to be a kind of deadlock. When I disable check box in my odbc driver of "enable query timeout" my program encounter a problem and freezes...
    Could someone help me ?

    user13335017 wrote:
    I have thought of the above solutions as workable, however, it is not. Some exhibited errors are:
    A. "Attempt to use database while environment is closed." This error applies to 2, 3 and 4 all the way;
    B. "Attempt to read / write database while database is closed." This error applies to 3 in particular;
    C. "Attempt to close environment while some database is still open." This error applies to 5.
    Please help me with designing a better strategy to solve the concurrent issue. Many thanks in advance.All these are expected errors. You should design the application so that you do not close an environment handle while database handles are still open, keep database handles open for as long as operations need to be performed on the underlying databases, open the database handles after opening the database handles, and close database handles before closing the environment handle.
    In short, in pseudo-code, you should have something like this:
    - open environment handle,
    - open database handles,
    - perform whatever operations are needed on the databases,
    - close database handles,
    - close environment handle.
    You can refer to the Getting Started with Data Storage and the Getting Started with Transaction Processing guides appropriate for the API you are using, from the Berkeley DB documentation page.
    Regards,
    Andrei

  • Analysis for Office support multi thread?

    Does Analysis for Office support multi thread/core? If so, what verison? I tried searching around this site as well as note 1466118 - Hardware & Software requirements for Analysis, edition for MS Office but was unable to find an answer.
    I am on an Intel dual cpu with hyper threading turned on so it essentially looks like 4 cores. When I execute an Analysis View, I rarely see the EXCEL.EXE process go above 25% CPU utilization. I have plenty of RAM and hard drive space.
    64bit Windows 7
    32bit Office 2010
    AAO 1.3.5.2288
    Thanks

    I found the following info at:
    Excel 2010 Performance: Performance and Limit Improvements
    Large Data Sets and 64-bit Excel
    The 64-bit version of Excel 2010 is not constrained to 2 GB of RAM like 32-bit applications. Therefore, 64-bit Excel 2010 enables users to create much larger workbooks. 64-bit Windows enables a larger addressable memory capacity, and 64-bit Excel is designed to take advantage of that capacity. For example, users are able to fill more of the grid with data than was possible in previous versions of Excel. As more RAM is added to the computer, Excel uses that additional memory, allows larger and larger workbooks, and scales with the amount of RAM available.
    In addition, because 64-bit Excel enables larger data sets, both 32-bit and 64-bit Excel 2010 introduce improvements to common large data set tasks such as entering and filling down data, sorting, filtering, and copying and pasting data. Memory usage is also optimized to be more efficient, in both the 32-bit and 64-bit versions of Excel.
    Multi-Core Processing
    Additional investments were made to take advantage of multi-core processors and increase performance for routine tasks. Starting in Excel 2010, the following features use multi-core processors: saving a file, opening a file, refreshing a PivotTable (for external data sources, except OLAP and SharePoint), sorting a cell table, sorting a PivotTable, and auto-sizing a column.
    For operations that involve reading and loading or writing data, such as opening a file, saving a file or refreshing data, splitting the operation into two processes increases performance speed. The first process gets the data, and the second process loads the data into the appropriate structure in memory or writes the data to a file. In this way, as soon as the first process beings reading a portion of data, the second process can immediately start loading or writing that data, while the first process continues to read the next portion of data. Previously, the first process had to finish reading all the data in a certain section before the second process could load that section of the data into memory or write the data to a file.

  • Crystal Report XI u2013 Multi Thread - function PEOpenEngineEx failed. Reason:

    In Crystal Report XI u2013 Multi Thread - function PEOpenEngineEx failed. Reason: Report engine not opened
    Hi
    I am using Crystal report XI with Delphi 7
    OS: Windows XP.
    Delphi 7
    CR Version: Crystal Report XI
    In Crystal Report XI While calling PEOpenEngineEx() by setting Engine option as multi thread, It failed with error message u201CError:512 Report Engine Not Openedu201D
    Code Change in Delphi 7 UCrpe32.pas (Crystal Reports XI Release 1 - Service Pack 3 and Service Pack 4)
    aEngineOptions.openEngineType := PE_OE_MULTI_THREADED;
    FEngineOpened := FCrpeEngine.PEOpenEngineEx(EngineOptions);
    I tried the same with Crystal Report 8.5 (above mentioned code change) Function PEOpenEngineEx() working fine.
    How to overcome this error to make work Multi Thread using CR XI?

    I found that it is bug Release 2 and the script server_patch_xir2 resolved it.

  • How can i use multi threading in labview?

    i want to run a Digital storage oscilloscope and an energ ratio meter simultaneously using labview. i am using GPIB interfacing and windows XP. how can i do this using multi threading. Bot the instruments shd run and give data at the same time.

    You can't do this - at least not with a single GPIB board. It has nothing to do with threading or LabVIEW. There can only be one talker at a time over the bus. Depending on the instruments, you could probably set them up to take measurements simultaneously but you have to sequentially poll them to get the data.

  • Multi-threaded application crashing the VM

    Hi,
    I have a multi-threaded (about 120 threads) application which crashes without after running for a while.
    I get this in the windows event viewer
    Faulting application java.exe, version 0.0.0.0, faulting module kernel32.dll, version 5.2.3790.0, fault address 0x000017b1.
    Anyone knows why this would happen?
    - vineet

    Hi Alexis,
    Thanks for the response to my post!!
    Which version of the JVM?C:\>java -version
    java version "1.4.2_05"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04)
    Java HotSpot(TM) Client VM (build 1.4.2_05-b04, mixed mode)
    Are you using the -server option?I was not using this option earlier but even on using this the jvm crashes after running for sometime.
    I am using these jvm options now -
    java -server -Xss128K -Xms256M -Xmx512M
    - vineet

  • Aggregate Storage And Multi-Threading/Multi-Core Systems

    Please pardon if this question has been asked before, but the Forum search is not returning any relevant results.
    We are in the process of purchasing hardware for an 11.1.2 Essbase environment. We are going 64-bit, on Windows 2008, with either 32 GB or 64 GB of system RAM. The debate we are having is the number of CPUs and cores per CPU. We have not built any ASO databases as of yet, but we plan to launch a major BSO to ASO conversion project once 11.1.2 is off the ground here.
    Historically, with BSO, we did not see performance improvements significant enough to justify the cost of additional CPUs when we ran calcs on multi-CPU systems vs. single or dual CPU systems, even when the settings and design should have taken the most advantage of BSO's multi-threading capabilities. However, it would seem that ASO's design may be able to make better use of multi-core systems.
    I know that there are a lot of factors behind any system's performance, but in general, is ASO in 11.1.2 written well enough to make it worthwhile to consider, say, a four CPU, total 16 core system vs. a 2 CPU, total four core system?

    Grand central dispatch - infancy, not really doing its job, and I don't think apps have to be specifically written for HT, but they do have to not do things that they use to - prevent threads from going to sleep! or be parked.
    high usage is not necessarily high efficiency. often the opposite.
    Windows 7 seems to be optimized for multi-core thanks to a lot of reworking. Intel wants and knows it isn't possible to hand code, that the hardware has to be smarter, too. But the OS has a job, and right now I don't think it does it properly. Or handle memory.
    Gulftown's 12MB cache will help, and over all should be 20% more efficient doing its work.
    With dual processors, and it doesn't look like there are two quick path bridges, data shuffling has led to memory thrashing. Use to be page thrashing with not enough memory. Then core thrashing but having the cores, but not integrated (2008 is often touted as being greatest design so far, but it was FOUR dual-cores, 2009 was the first with a processor that really was new design and (native) 4-core.
    One core should be owned by the OS so it is always available for its own work and housekeeping.
    The iTunes audio bug last year showed how damaging and not to implement code and how a thread could usurp processing and add a high cpu temperature while basically doing nothing, sort of a denial of service attack on the processor - those 80*C temps people had.
    All those new technology features under development and not like OpenCL, GCD and even OpenGL are tested, mature but rather 1.0 foundation for the future. A year ahead of readiness.

  • CS6 After Effects PNG export very slow - Not Multi-Threaded?

    I am rendering an after effects project consisting of over 320,000 source frames of 4000x4000 resolution, outputting over 250,000 frames as PNG files.
    Rendering is instant on our machines, all time is spent "compressing and writing" frames. It is taking forever.
    We have several machines that are all windows 7, with 16 physical cores, 64GB ram, connected to a 4Gbit SAN.
    I did some experimenting, tried using all 16 cores, or 8 cores, or disabled multi-frame rendering even. When this project is rendering my cpu usage is almost non existent,. maybe 1%-5%  at times.
    with 16 frames at a time being rendered it is averaging between 1 and 7 seconds per frame depending on the content of the frame.
    Does Adobe have any plans to multi-thread the PNG exporter? or is there a faster 3rd party plugin out there i could use? It is very slow and doesn't tax the CPU's at all. Even on a single core it doesnt even use 100% cpu while its saving.
    I even tried loading one of the frames into photoshop and simpy hit save as a PNG and it took almost 15 seconds to compress and save. I did it again without compression and it saved the 40MB raw file instantly.
    That is terrible performance for machines like mine that are pretty much the fastest things out there.
    Thanks!

    I appreciate your attempt for a workaround solution, however as you well know you can't render to a video file from multiple machines. we must output directly to individual frames, I setup 8 machines to work on this project, if we did not use compression then we would be writing over 300MB/sec of data which would not be good for our fibre network which unfortunatly is only 4Gbit. And it would be about 10TB of data total.
    As for your workaround Im not sure we could gain speed with your method either way. spending the extra time to encode to a lossless format and then process again in AME sounds like it would take even more time, unless AME could create PNG files at some sort of ridiculous speed maxxing out every core at 100% or something to compress the PNG's. Out of curiosity I will throw some frames at AME and see how long it takes to compress and how much cpu it will use.
    thanks

  • Multi-threaded video decoding problem

    I have simple AIR 3.8 application with 2 VideoPlayers:
    <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    xmlns:mx="library://ns.adobe.com/flex/mx"
    applicationComplete="init()"
    showStatusBar="false"
    >
    <fx:Script source="MultiVideoPlayer.as" />
    <s:VGroup width="100%" height="100%" >
    <s:HGroup width="100%" height="100%" id="row1" >
    <s:VideoPlayer width="100%" height="100%" source="assets/2.mp4"/>
    <s:VideoPlayer width="100%" height="100%" source="assets/3.mp4"/>
    </s:HGroup>
    </s:VGroup>
    </s:WindowedApplication>
    Both videos are H.264 Full HD samples.
    I launch application and multi-threaded decoding works fine - all cores are involved and CPU usage is around 70%.
    When I replace source of VideoPlayers with exactly same files programmatically - videos are reloading, but they doesn't play smoothly and multi-threaded decoding isn't working anymore - CPU usage drops to 10%.
    Is there any way  to force use of multi-threaded video decoding when videos are loaded dynamically?

    After some hunting I found a Twitter post confirming that StageVideo on AIR 3.2 is not supported on Desktop.
    But one of the notable features of Flash Player 11.2 is Multi-threaded video decoding.
    Does this mean that standard (non-StageVideo) implementations of Video are now automatically using a separate CPU thread?
    If so, this would be a reasonable workaround for smooth video on Desktop.
    Here's Adobe's description of the feature...very vague.
    Multithreaded video decoding (Windows, Mac OS, and Linux) — The video decoding pipeline is now fully multithreaded. This feature should improve the overall performance on all platforms. Note that this feature is a significant architecture change required for other future improvements.

  • Java multi-thread Applet and Multi-processor

    Hello,
    I have a JAVA applet which work fine on a mono-processeur machine and not fine at all on multi-processors.
    It use multi thread (for reading on socket) and some times, request are lost.
    Is that a matter of programming or a JVM bug ?
    This happens on Linux and Windows NT bi-processors.
    We hare using JAVA 1.3.0_02
    Thanks for your help
    [email protected]

    I have already have a look to javax.swing.SwingUtilities.invokeLater() but (I think) it don't work for my need.
    A graphic applet which create 2 threads : one for reading and one for writing on a socket.
    Request sent to the server are memorized in a vector, and once answer is received, the request is remove from vector and treated. Access to the list is protected by synchronize.
    Everything works fine one several plateforme (linux, windows 98/2000/NT, Solaris). The only problem is on multi-processor : request are lost !

  • SSRS - Is there a multi thread safe way of displaying information from a DataSet in a Report Header?

     In order to dynamically display data in the Report Header based in the current record of the Dataset, we started using Shared Variables, we initially used ReportItems!SomeTextbox.Value, but we noticed that when SomeTextbox was not rendered in the body
    (usually because a comment section grow to occupy most of the page if not more than one page), then the ReportItem printed a blank/null value.
    So, a method was defined in the Code section of the report that would set the value to the shared variable:
    public shared Params as String
    public shared Function SetValues(Param as String ) as String
    Params = Param
    Return Params 
    End Function
    Which would be called in the detail section of the tablix, then in the header a textbox would hold the following expression:
    =Code.Params
    This worked beautifully since, it now didn't mattered that the body section didn't had the SetValues call, the variable persited and the Header displayed the correct value. Our problem now is that when the report is being called in different threads with
    different data, the variable being shared/static gets modified by all the reports being run at the same time. 
    So far I've tried several things:
    - The variables need to be shared, otherwise the value set in the Body can't be seen by the header.
    - Using Hashtables behaves exactly like the ReportItem option.
    - Using a C# DLL with non static variables to take care of this, didn't work because apparently when the DLL is being called by the Body generates a different instance of the DLL than when it's called from the header.
    So is there a way to deal with this issue in a multi thread safe way?
    Thanks in advance!
     

    Hi Angel,
    Per my understanding that you want to dynamic display the group data in the report header, you have set page break based on the group, so when click to the next page, the report hearder will change according to the value in the group, when you are using
    the shared variables you got the multiple thread safe problem, right?
    I have tested on my local environment and can reproduce the issue, according to the multiple safe problem the better way is to use the harshtable behaves in the custom code,  you have mentioned that you have tryied touse the harshtable but finally got
    the same result as using the ReportItem!TextBox.Value, the problem can be cuased by the logic of the code that not works fine.
    Please reference to the custom code below which works fine and can get all the expect value display on every page:
    Shared ht As System.Collections.Hashtable = New System.Collections.Hashtable
    Public Function SetGroupHeader( ByVal group As Object _
    ,ByRef groupName As String _
    ,ByRef userID As String) As String
    Dim key As String = groupName & userID
    If Not group Is Nothing Then
    Dim g As String = CType(group, String)
    If Not (ht.ContainsKey(key)) Then
    ' must be the first pass so set the current group to group
    ht.Add(key, g)
    Else
    If Not (ht(key).Equals(g)) Then
    ht(key) = g
    End If
    End If
    End If
    Return ht(key)
    End Function
    Using this exprssion in the textbox of the reportheader:
    =Code.SetGroupHeader(ReportItems!Language.Value,"GroupName", User!UserID)
    Links belowe about the hashtable and the mutiple threads safe problem for your reference:
    http://stackoverflow.com/questions/2067537/ssrs-code-shared-variables-and-simultaneous-report-execution
    http://sqlserverbiblog.wordpress.com/2011/10/10/using-custom-code-functions-in-reporting-services-reports/
    If you still have any problem, please feel free to ask.
    Regards
    Vicky Liu

  • Memory leaks and multi threading issues in managed client.

    In our company we use a lot of Oracle, and after the release of the managed provider we migrated all applications to it. First the  things were very impressive : the new client was faster, but after some days applications that uses 100MB with old client goes to 1GB and up. The memory is not the only issue, we use a lot of multi threading, and we experience connection drops and not disposal, after 1 days working one of the application had over 100 sessions on the server. I think there is something wrong with connection pool and multi threading.
    Is someone experience same problems.
    Yesterday we went back with unmanaged provider. Now things are back to normal.

    connection drops: did you try to use "Validate Connection=true" parameter in your connection string?
    the new client was faster: are you sure with this statement? Even in 64bit environment? I got quite serious performance problems when running application under 64bit process: https://forums.oracle.com/thread/2595323

Maybe you are looking for