On 02/08/2018 01:19 PM, Matthias Bläsing wrote:

Hi,

Am Donnerstag, den 08.02.2018, 12:06 -0800 schrieb Semyon Sadetsky:
Yet another question. Do you know what might call CoInitialize in a
different mode? It looks like we use STA everywhere in JDK.
I tried to find some documentation how the FullTrustProcessLauncher of
an UWP application works, but while the MSDN full of documentation
about UWP, the lifecycle of a native application seems not to be
covered. But my suspicion is this: The launching of an APPX package
involves the runtime system creating an environment for the application
and that seems to rely heavily on COM.
It looks like there is an internal reason. Probably for UWP apps only MTA is allowed because of their life-cycle (the app may be suspended).
So I assume, that COM is initialized outside the java core and the java
process get this inherited. (But this is speculation!).

I base this on the fact, that CoInitializeEx succeeds and multi
threaded, but fails appartment threaded and the JDK code holds exactly
three files calling CoInitialize (D2DPipelineManager.cpp,
ShellFolder2.cpp, PLATFORM_API_WinOS_DirectSound.cpp).

On 02/08/2018 11:55 AM, Semyon Sadetsky wrote:
I meant the case when MTA COM service is actually used, it might cause
issues since the JDK code invokes an another API which assumes
synchronization. At least performance may be affected.

We don't do separate testing of JDK in MTA mode especially on the
regular base. That is why I wouldn't consider MTA mode as supported.

So, before push the change I would make sure of the regression test
suite run in MTA mode hasn't brought any surprises.
Aggreed and I'd like to help you, but in fact I was happy, that I
managed to compile the JDK on windows and I have zero experience
working on the JDK sources.
Prasanta,

since the bug is assigned to you can you test the suggested fix in MTA mode and sponsor it if there are no issues?

--Semyon

As an observation: The COM initialization and usage looked pretty tight
together in the sources and at least initialization happens only in the
three files mentioned above. The DirectSound part is even limit to a
small thread. The ShellFolder2 code looks to be the biggest direct
user.

Greetings,
Matthias

Reply via email to