Results 1 to 11 of 11

Thread: Intentionally make a program stop responding.

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2007
    Posts
    520

    Intentionally make a program stop responding.

    I am making a process monitoring program for his game server. Occasionally, the programs stop responding.


    I've used the if process.responding then process.kill la de da, but its not working right.


    Is there a debugging tool out there i could use to intentionally make a program stop responding?

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,424

    Re: Intentionally make a program stop responding.

    you could use the BlockInput api function:

    vb Code:
    1. Private Declare Function apiBlockInput Lib "user32" Alias "BlockInput" (ByVal fBlockIt As Boolean) As Boolean

    the only problem is it doesn't just block input for your app.

  3. #3
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,206

    Re: Intentionally make a program stop responding.

    Just write a simple little program that hangs for a while

    Something like this should do it
    Code:
        Private Sub btnHang_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHang.Click
            Dim Started As Date = TimeOfDay
            While 1 < 2
                If TimeOfDay > DateAdd(DateInterval.Minute, 5, Started) Then
                    Exit While
                End If
            End While
        End Sub
    After 5 minutes it will start responding again

  4. #4
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,109

    Re: Intentionally make a program stop responding.

    If you are threading, you could cause an intentional deadlock. Have two Mutex objects. Two threads start. The first thread grabs the first Mutex then Sleeps for half a second and tries to get the second Mutex. The second thread grabs the second Mutex, sleeps for half a second, then tries to get the first Mutex. That should cause a guaranteed deadlock, which will lock the program up completely.
    My usual boring signature: Nothing

  5. #5
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,109

    Re: Intentionally make a program stop responding.

    I considered the loop proposed by DataMiser, but it will do things other than just locking up, because it will also max out your CPU. The deadlock approach will take no CPU time, though it is more complicated (and won't end, which is a nice feature of the loop DM suggested).
    My usual boring signature: Nothing

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2007
    Posts
    520

    Re: Intentionally make a program stop responding.

    The program i am trying to make stop responding is not developed by me (it's a dedicated serve exe).

  7. #7
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,424

    Re: Intentionally make a program stop responding.

    that makes it much more difficult

  8. #8
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,206

    Re: Intentionally make a program stop responding.

    I thought you were trying to find a way to test your processing monitoring software. If you are trying to cause the gameserver to lock then you would almost have to know what is causing it to lock now and then reproduce that.

  9. #9
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Intentionally make a program stop responding.

    Just because an app stops responding doesn't mean its locked up. It could mean that it is so busy that it can't respond to requests to update the ui
    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  10. #10
    PowerPoster i00's Avatar
    Join Date
    Mar 2002
    Location
    1/2 way accross the galaxy.. and then some
    Posts
    2,390

    Re: Intentionally make a program stop responding.

    Quote Originally Posted by techgnome View Post
    Just because an app stops responding doesn't mean its locked up. It could mean that it is so busy that it can't respond to requests to update the ui
    -tg
    no it just means it's running an intensive process on the interface thread...

    if you have a process hungry function you should look @ putting it in a non-interface thread.

    Kris

  11. #11

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2007
    Posts
    520

    Re: Intentionally make a program stop responding.

    Ya, i guess i'll just make a dummy app that locks up for testing.

    I was just curious if there was a debug tool that would literally lock up an app to make it stop responding.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width