I wonder if you are using the right API in the first place.  From the 
documentation at 
http://msdn.microsoft.com/en-us/library/windows/desktop/aa384247(v=vs.85).aspx:

Note  WinINet does not support server implementations. In addition, it should 
not be used from a service. For server implementations or services use 
Microsoft Windows HTTP Services 
(WinHTTP)<http://msdn.microsoft.com/en-us/library/windows/desktop/aa384273(v=vs.85).aspx>.

Since Windows Installer is a service and it is what is running the MSI, your 
custom action would be running like a service. Unfortunately, the docs don’t 
list why you shouldn’t use WinINet.

From: Rob Mensching [mailto:[email protected]]
Sent: Tuesday, February 19, 2013 8:48 AM
To: Windows Installer XML toolset developer mailing list
Subject: Re: [WiX-devs] Memory storage in thread of Custom Action

No.

On Tue, Feb 19, 2013 at 6:43 AM, Yun Li 
<[email protected]<mailto:[email protected]>> wrote:
Thanks, can I force or configure the process to go away when the custom action 
returns? Which will resolve my thread problem.

On Tue, Feb 19, 2013 at 10:29 PM, Rob Mensching 
<[email protected]<mailto:[email protected]>> wrote:
Yes plus there is no guarantee the process won't go away or that your CA DLL 
won't get put into a different process. Best to assume as I described above, 
your process always goes away.

On Tue, Feb 19, 2013 at 6:10 AM, Yun Li 
<[email protected]<mailto:[email protected]>> wrote:
Hi,

In my speculation, when WIX execute a custom action, it will do the following: 
(My custom action is in a DLL written with C++)

1. If there is no process for custom actions, it will create a process.
2. Load the DLL.
3. Execute the custom action function
4. Unload the DLL.

However, the process won't exit after the custom action returns.  (WIX will 
create one process for InstallUISequence custom actions, and one for 
InstallExecuteSequence custom actions).

If I understand correctly of the above, then my problem will be:
When the DLL is unloaded, there were threads created in the custom action 
function still running on the code of the DLL, then my thread get crashed.

Is my understanding right?

Thank you very much for your help!

Thanks,
Yun

On Mon, Feb 18, 2013 at 11:42 PM, Rob Mensching 
<[email protected]<mailto:[email protected]>> wrote:
1. The Windows Installer creates separate processes for Custom Actions. The WiX 
toolset does the same for managed custom actions for the reasons Jacob pointed 
out.

2. Threads execute independently in a process. Unless you write code to ensure 
one thread outlasts another (Thread.Join?) there is no guarantee which threads 
still exists as threads exit.

On Sun, Feb 17, 2013 at 8:45 PM, Yun Li 
<[email protected]<mailto:[email protected]>> wrote:
I'm using C++, and the thread is created when I initialize a HTTP request in 
custom action, i.e., it is created by Windows WinInet API HttpSendRequest().
The http callback thread crashes when the custom action finishes.
There will be an exception dialog appear when this problem happens, but the 
installation can continue to finish, seems it doesn't influence the main 
install process.

On Mon, Feb 18, 2013 at 12:27 PM, Hoover, Jacob 
<[email protected]<mailto:[email protected]>> wrote:
How exactly are you creating this thread? What language and framework are you 
using?

Sent from my iPhone

On Feb 17, 2013, at 8:48 PM, "Yun Li" 
<[email protected]<mailto:[email protected]>> wrote:
Thanks for you reply.

So if I understand correctly, actually WIX will create a process for each 
custom action. However, I can't figure out why the http thread created in the 
custom action doesn't exit when the process exit, it continues to execute and 
leads to a crash when try to access heap memories in the process.
Is there a way to resolve this?

Thanks!
Yun

On Sun, Feb 17, 2013 at 12:12 AM, Hoover, Jacob 
<[email protected]<mailto:[email protected]>> wrote:
I believe this is caused by any .net ca being done in a separate stub process. 
Prior to .net 4, you could only have one version of the clr loaded during the 
life of the process. The wix fix which allows us to overcome this is using 
child stub processes and ipc to overcome this.


On Feb 16, 2013, at 7:26 AM, "Yun Li" 
<[email protected]<mailto:[email protected]>> wrote:
Hi, WIX Devs

Thanks for such a great tool!

I have a problem developing my own installers with Wix.
I defined several custom actions in a DLL, these functions share a same 
behavior that they need to send the instrumentation data to our server through 
HTTP request.
When WIX calls a custom action, as my observation, it starts a new thread for 
the function, and the thread exits after the function is returned.
However, the problem is when the thread exits, the heap storage created in the 
custom action thread is also removed! Which leads to a crash when HTTP callback 
thread tries to access the objects created in the heap.
What described above is only my observation, I just want to confirm whether 
this is really the memory management method of thread adopted by WIX (something 
like ThreadLocal, if I understand correctly), therefore we can think about 
other ways for solution.

Thanks,
Yun
------------------------------------------------------------------------------
The Go Parallel Website, sponsored by Intel - in partnership with Geeknet,
is your hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials, tech docs,
whitepapers, evaluation guides, and opinion stories. Check out the most
recent posts - join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
WiX-devs mailing list
[email protected]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/wix-devs

------------------------------------------------------------------------------
The Go Parallel Website, sponsored by Intel - in partnership with Geeknet,
is your hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials, tech docs,
whitepapers, evaluation guides, and opinion stories. Check out the most
recent posts - join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
WiX-devs mailing list
[email protected]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/wix-devs

------------------------------------------------------------------------------
The Go Parallel Website, sponsored by Intel - in partnership with Geeknet,
is your hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials, tech docs,
whitepapers, evaluation guides, and opinion stories. Check out the most
recent posts - join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
WiX-devs mailing list
[email protected]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/wix-devs

------------------------------------------------------------------------------
The Go Parallel Website, sponsored by Intel - in partnership with Geeknet,
is your hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials, tech docs,
whitepapers, evaluation guides, and opinion stories. Check out the most
recent posts - join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
WiX-devs mailing list
[email protected]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/wix-devs


------------------------------------------------------------------------------
The Go Parallel Website, sponsored by Intel - in partnership with Geeknet,
is your hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials, tech docs,
whitepapers, evaluation guides, and opinion stories. Check out the most
recent posts - join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
WiX-devs mailing list
[email protected]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/wix-devs


------------------------------------------------------------------------------
The Go Parallel Website, sponsored by Intel - in partnership with Geeknet,
is your hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials, tech docs,
whitepapers, evaluation guides, and opinion stories. Check out the most
recent posts - join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
WiX-devs mailing list
[email protected]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/wix-devs


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb

_______________________________________________
WiX-devs mailing list
[email protected]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/wix-devs


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
WiX-devs mailing list
[email protected]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/wix-devs


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
WiX-devs mailing list
[email protected]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/wix-devs

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
WiX-devs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-devs

Reply via email to