Hi All, I'm hoping someone here can help me with this one, I dont have much hair left after working on it the last few days. It boils down to this - On my local dev machine I can pass a datatable object to a new thread call - Dim dt as DataTable = MyClass.GetDataTable Dim MyThread As New Threading.Thread(AddressOf CheckReminders) MyThread.IsBackground = True MyThread.Name = "Email" MyThread.Start(dt) And this works fine, however when I deploy it to my Winhost account the code can't cast the object back to a DataTable within the thread. I then thought it might be the difference between IIS and the built in web server in Visual Studio so I deployed the code to the IIS on my local machine and yet again it worked just fine. So does anyone have any suggestions about what this problem might be? Do threads run differently or on different permissions when hosted here? I've already set up a ticket and they kindly showed me that one of their threads can wait for two seconds before moving on which doesnt really help me out at all. Any suggestions? Anyone?
What else do you do after you start up the thread? Maybe it's a case of the main thread trying to access the dt object before the child thread gets to finish populating it?
You're most probably running into some kind of races issue, are you sure your code is thread safe? Do a couple of log messages - see whether the dt is actually instantiated before you start the background thread...
sorry for the late reply.... .. i was on vacation Cruz - I've tried populating the dt in the child thread and in the main thread and passing it through, both of these options work locally but not when deployed. stevozilik - I've logged the heck out of it, everything works apart from trying to access the dt in the second thread, I'm able to pass through strings which work just fine when deployed in the same manner. The only time I have a problem is when I'm using a datatable in the second thread, and only when deployed to my hosting account, the code works just fine locally in the numerous ways I've tried to do it. Ray - All I'm seeing is a 500 - Internal Server Error message, this is probably due to the fact that its not the main thread thats having problem, I'll change my local debugging to see if I can get more information from the server when its deployed. What I'm trying to do is pretty simple in essence, I want to pass a datatable to a second thread and loop through the rows to take action on each one. I can pass strings to the thread and that works just fine and I can perform the necessary operation just fine. The only problem I have is that when the code is deployed it has a problem with the passed datatable, why does this work locally and not when deployed?
bug...of some description ok, here's where ive got too. The code that works for me locally in a thread has now been completely deconstructed and no longer replies on threads. What I am seeing now I can't explain. When I try to populate a datatable using a certain stored proc I am getting symbols displayed in the postback with no error message which would explain why my thread was hanging without giving me a proper error message. The source of the page that is displayed is shown at the bottom (and no this forum hasnt messed it up that's exactly how it looks in the browser) So, why does cassini not have this problem and why is it only an issue with one certain stored proc?? Answers on a postcard ���`I�%&/m�{J�J��t��`$ؐ@�������iG#)�*��eVe]f@�흼��{����{����;�N'���?\fdl��J�ɞ!���?~|?"��Ey�')=��y6�����h�����O��6����Η�<]Vm��m�Vi�L�e�f��:ǟ�?�+/{К�:� �T����W�v�<[����~2�g�2���?�ʋ�y�hYՋ�������t� _N���M�l�������{��,���Xn���Q�}��������*g�������7�� ~�`�j'u>K�{_��IW�2����������,KO�eS��יy�/����m^+E eB��c*�j�w��,�Vu���q�2?@]�uC_��X_�����E^���d�Tm[-��;�w�v�V�r�MJY��y���uYP祐���2�����uC� ԡO��w}V|W�J�d��\0��>��m���ւh�����=z��4���GV,ӏ��yӒ�]��ǫUYL���y�^�v�������b:>�|?k���=�K{]���������#�#،r:H��g������"+G��sB�%�G���2�������ٲ�~�_�ˬ� �j��8O#ę�O�fZ+a��w'G��t��T�$��i�ߥՔf r2[���"m�9}�O���9�Mͫ|B��Ek"�8}Y�Y��ߗE~�͈ӷi[�`�3�tQ�d�s���&պ�.x���j��U�VuAL���M#w[��qp4O��ؠO����mV����u�����uY�2�g�>J������Z�Ԝ9��ƹe��������3�br�7����!�ۦ�w %w?�WY�^��L����3o���"�g�}�U���I4�\�S�넘`F����0X7��g�I^VW$]v\�1ߍ�>풏>�4D�2>��������}Lv�q��7����^�����r �?~�/ ��g���5+Q�n�ӭ;�'���n�ڼ��d�函���O�o}:~�&k����OH���ұ49@���Kb����Is�s��`T� ���3� ���U�(���K����{��_eE����� q��zݲ�� p���r�v �g�o�����m�חdc0��� +3E��@G�ޣ��"�ɬ\Բ̙#��x��������u5͛��h�/�b���"�ywZ�g�k���IN�(?n��ӗU�lGi���y��q����q��.$��@����D��O����`VK�p9iV�_Ӻj��6�8}�>���WU�6����w��w�=�����ǯ_r���{�߅��|��pގ@B �������J����I�[��N�l�y���N�����@�Q�c ��/�V/��7����~�����٨�6��Y�D$0�n��W�Q����p��Wy���`���ٿk�uu������-���p(q˞�z�}����Eu�P��na���Y��矷���m�����/2�S��W�����?kV��\���x�$+K��S$�n���6�-��<J�����m�`(0�Wvf!�a�*s�c^ӄ�/�uS^S��Gj��̋FcP(] ���'� o�����I>���I����b����U3��R�ғ�1��Ȍ �x���FZ7�tak(B�Q�����Gw�E{8���A� /,�=EWCMȒUmN�Z�ҸVu5[��˗�Q*�oo�?U�n�
IMHO that brings you closer to resolving the issue. Try to narrow it down further. 1 - What does that "certain stored procedure" return if you run it in SQL Management Studio? 2 - What if you only use one thread? 3 - Build a small app multi-threaded version that uses that stored procedure and dump the contents different parts of a page. As for differences in your local environment or how cassini differs from IIS, I think we can start asking those questions once we know where the issue is coming from.
update Hi, I response to your questions - 1) It's works fine in SQL Management Studio, it works fine in cassini, it works fine deployed to a local IIS 2) I have changed to code to only use one thread (previous post), this error is happening on a single thread 3) I'm not sure what you mean Someone has suggested it may be a compression setting in my Winhost IIS settings so I'm going to first have a look at the http request and response with fiddler and then try to change the compression settings. Thanks for the help so far, its a tricky one
next IIS isnt set up for any compression, fiddler is showing a internal 500 error with the garbage response, ill have to try and catch it in the global.asax and log it to see if theres more info in that