I have no idea how to establish if a given codebase is thread-safe or not.
Documentation could mention it, but based on your experience, I would say
that it is not.
I am not certain why hyper-threading has to do with this discussion. It is a
fact that some codebases are not thread-safe; it is also a fact that
concurrency introduced by hyper-threading is not always helpful.
So, why do you assume that GDI+ is supposed to work in a concurrent
environment? Just because you can access code from ASP.Net does NOT make
that code thread-safe. Concurrency isn't exactly magic pixie dust that you
sprinkle into a system and things magically work better.
Besides, it is usually better to write code without locks built-in, so that
the user can determine their usage requirements -- you can always add locks
externally to serialize -- you cannot remove locks to deserialize code you
do not own.
So, serialization does not require access to source code. You can always
write a wrapper around an assembly and serialize your wrapper. Or you can
serialize in your code on access to the unserialized code. Design is up to
you.
--
//David
IIS
http://blogs.msdn.com/David.Wang This posting is provided "AS IS" with no warranties, and confers no rights.
//
[quoted text, click to view] "tommapdotnet" <tommapdotnet@discussions.microsoft.com> wrote in message
news:CF247BAB-DEEA-421F-8D47-30CCA296D977@microsoft.com...
David,
Thanks for the swift response.
How do I establish if the Microsoft GDI+ .NET assemblies are thread safe?
Does this not defeat the object of having hyper-threading machines?
How would I go about serialize/locks assemblies I do not have the source to?
Tom
[quoted text, click to view] "David Wang [Msft]" wrote:
> Are you sure that the GDI+ APIs that you are calling are thread-safe --
i.e.
> do they require locks to serialize traffic.
>
> Because if they are not thread-safe and you call it from ISAPI in a
> non-thread-safe manner, then the hang would be by-design. In general, UI
> APIs do not expect multi-user/multi-thread environments like an IIS
> server... because only one user interacts with UI at a time.
>
> --
> //David
> IIS
>
http://blogs.msdn.com/David.Wang > This posting is provided "AS IS" with no warranties, and confers no
rights.
> //
> "tommapdotnet" <tommapdotnet@discussions.microsoft.com> wrote in message
> news:E4487DBD-7FC7-43CF-8C22-925C55508535@microsoft.com...
> Have been advised to approach this forum, having tried ASP.NET
> We have a web application that stream images (generated by IIS6/GDI+) back
> to the client. On one particular server (MS 2003 web edition server, 2GB
> memory, twin 2.6GHz cpus, latest patches etc.) we are experiencing a
problem
> where the image generator is hanging erratically and requires an IIS reset
> to
> get it running again. There are no error messages and no event log
entries.
> IIS continues to serve the non-GDI elements. The GDI is decoding
> raster/bitmaps. Hence we think there is an issue with the GDI. Has anyone
> had
> anything similar?
>
> Have now loaded DebugDiag and left it sniffing a simple GDI program
running
> on our live server.
> It failed within 24 hours and the hang analysis pointed to:
>
> '************************************
> Detected possible blocking or leaked critical section at
> GdiPlus!Globals::TextCriticalSection owned by thread 15 in
>
w3wp.exe__DefaultAppPool__PID__2384__Date__11_23_2005__Time_09_05_36AM__953_
> _IIS Hang Dump.dmp
>
> Impact of this lock
>
> 6.90% of threads blocked
>
> (Threads 11 16)
>
> The following functions are trying to enter this critical section
>
> GdiPlus!GdipCreateFontFamilyFromName+5d
>
> GdiPlus!GdipCreateStringFormat+68
>
> The following module(s) are involved with this critical section
>
>
C:\WINDOWS\WinSxS\x86_Microsoft.Windows.GdiPlus_6595b64144ccf1df_1.0.3790.18
> 30_x-ww_24C40C58\GdiPlus.dll from Microsoft Corporation
> '***************************************
>
> This seems to confirm our suspicion of it being a Microsoft GDI+ problem.
> The program was attempting to dimension a new Stringformat object and
failed
> with no errors whatsoever.
>
> What else should we look for in the analysis?
>
> Are there any updates to GDI+; or has this been resolved in Framework 2.0
>