thread.start() does not actually execute the assigned method

Discussion in 'ASP .Net' started by =?Utf-8?B?Y2hyaXN2Yw==?=, Apr 27, 2005.

  1. I have an ASP.NET application that creates 4 threads in the Application
    OnStart event. Each thread is stored in the Application object collection.

    This code works perfectly on my dev machine, running WindowsXPpro with
    VS.NET 2003 installed. Each thread is started and goes about its tasks as
    expected.

    This code fails on a dev Win2K Server. There is no exception thrown. The
    methods that should be executed on each of the threads are just not run at
    all.

    I have attempted to get my dev machine to produce the same outcome by
    matching all the user privileges and using the config files from the Win2K
    machine, without success.

    I have hunted high and low for any information that might point me in the
    right direction as to why this is happening, again with no success. Any help
    I can get on this one will be greatly appreciated.

    Thanks all.
    CVC
    =?Utf-8?B?Y2hyaXN2Yw==?=, Apr 27, 2005
    #1
    1. Advertising

  2. =?Utf-8?B?Y2hyaXN2Yw==?=

    Brock Allen Guest

    Are you running in a partial trust environment? It's possible that your application
    has not been granted sufficient permissions to create and control threads.

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen



    > I have an ASP.NET application that creates 4 threads in the
    > Application OnStart event. Each thread is stored in the Application
    > object collection.
    >
    > This code works perfectly on my dev machine, running WindowsXPpro with
    > VS.NET 2003 installed. Each thread is started and goes about its
    > tasks as expected.
    >
    > This code fails on a dev Win2K Server. There is no exception thrown.
    > The methods that should be executed on each of the threads are just
    > not run at all.
    >
    > I have attempted to get my dev machine to produce the same outcome by
    > matching all the user privileges and using the config files from the
    > Win2K machine, without success.
    >
    > I have hunted high and low for any information that might point me in
    > the right direction as to why this is happening, again with no
    > success. Any help I can get on this one will be greatly appreciated.
    >
    > Thanks all.
    > CVC
    Brock Allen, Apr 27, 2005
    #2
    1. Advertising

  3. It has taken me a long time to get back to the forum to update this post. My
    apologies for that.

    In the end I figured out what the problem was... however, although not an
    issue at the moment, I would like to understand why this was a problem, so
    any pointers on that would be great.

    So, my threads all log information to a database through a logging object.
    This object was using the StackTrace object to establish the calling class
    and method rather than every call to the logging object having to provide the
    info. This code was the problem, without it everything worked perfectly.

    So, I found where the problem was and fixed it. However I don't understand
    why accessing the StackTrace would cause this problem. Can anyone help me
    out on that?

    Thanks all.
    CVC

    "chrisvc" wrote:

    > I have an ASP.NET application that creates 4 threads in the Application
    > OnStart event. Each thread is stored in the Application object collection.
    >
    > This code works perfectly on my dev machine, running WindowsXPpro with
    > VS.NET 2003 installed. Each thread is started and goes about its tasks as
    > expected.
    >
    > This code fails on a dev Win2K Server. There is no exception thrown. The
    > methods that should be executed on each of the threads are just not run at
    > all.
    >
    > I have attempted to get my dev machine to produce the same outcome by
    > matching all the user privileges and using the config files from the Win2K
    > machine, without success.
    >
    > I have hunted high and low for any information that might point me in the
    > right direction as to why this is happening, again with no success. Any help
    > I can get on this one will be greatly appreciated.
    >
    > Thanks all.
    > CVC
    >
    =?Utf-8?B?Y2hyaXN2Yw==?=, May 14, 2005
    #3
  4. Thanks for you response Brock. Sorry it has taken me so long to get back to
    you. I have updated the main thread with where I am at.

    How do I tell if I am running in a partial trust environment? Can you point
    me at some good www sites to do a some reading on the topic?

    Thanks again.
    Chris

    "Brock Allen" wrote:

    > Are you running in a partial trust environment? It's possible that your application
    > has not been granted sufficient permissions to create and control threads.
    >
    > -Brock
    > DevelopMentor
    > http://staff.develop.com/ballen
    >
    >
    >
    > > I have an ASP.NET application that creates 4 threads in the
    > > Application OnStart event. Each thread is stored in the Application
    > > object collection.
    > >
    > > This code works perfectly on my dev machine, running WindowsXPpro with
    > > VS.NET 2003 installed. Each thread is started and goes about its
    > > tasks as expected.
    > >
    > > This code fails on a dev Win2K Server. There is no exception thrown.
    > > The methods that should be executed on each of the threads are just
    > > not run at all.
    > >
    > > I have attempted to get my dev machine to produce the same outcome by
    > > matching all the user privileges and using the config files from the
    > > Win2K machine, without success.
    > >
    > > I have hunted high and low for any information that might point me in
    > > the right direction as to why this is happening, again with no
    > > success. Any help I can get on this one will be greatly appreciated.
    > >
    > > Thanks all.
    > > CVC

    >
    >
    >
    >
    =?Utf-8?B?Y2hyaXN2Yw==?=, May 14, 2005
    #4
  5. =?Utf-8?B?Y2hyaXN2Yw==?=

    davidallen

    Joined:
    Jun 10, 2007
    Messages:
    1
    Thanks for highlighting the link to StackTrace.
    I also have come across this problem with a standard .NET windows application.
    I had used StackTrace in writing to a trace log. When running in the IDE, for debug or release builds, everything works fine.
    However when runnning a release build from windows explorer it misbehaves. It fails to start a particular thread (some others seem to work ok, I think). The thread uses code such as :

    othreadstart = new threadstart(addressof myfunc)
    oThread = new thread(othreadstart)

    the function (myfunc) is never called !

    What a git of a bug!http://www.velocityreviews.com/forums/images/icons/icon8.gif
    Angry
    davidallen, Jun 10, 2007
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alek Nazarian
    Replies:
    7
    Views:
    3,224
    Alek Nazarian
    Oct 22, 2003
  2. Enigma Curry
    Replies:
    1
    Views:
    486
    Peter Hansen
    Mar 15, 2006
  3. Replies:
    5
    Views:
    1,609
    Roedy Green
    Jun 20, 2008
  4. Savas Ates
    Replies:
    1
    Views:
    278
    Patrice
    Aug 17, 2004
  5. K. Frank
    Replies:
    9
    Views:
    1,413
    Alf P. Steinbach
    Jan 16, 2012
Loading...

Share This Page