The company's development environment \ test environment and production environment are quite different. before each new version starts, it takes a long time to debug the test environment. A major part of the work is to change the database link and interface address. however, simple activities always have problems. After the environment was configured last Friday, the CPU and memory usage was low, but the web page took a long time to display, based on past experience, it is determined that an interface address is incorrect, resulting in a long wait. However, after checking some of the most common addresses, the relevant developers cannot find the root cause of the problem.
The dump file can record the active thread conditions and can be used to find the waiting point. The following is a specific analysis process. Maybe this is a costly method. If you want to have a better method, share it with me.
(1) Visit the test environment website. When the page is waiting for a long time, run adplus. vbs-Hang-PN w3wp.exe-o d: \ ops \ to generate a dump file.
(2) Open the generated DMP file in windbg, first load the SOS extension with. Load SOS. dll, and run ~ * E! Clrstack: view the managed stacks of all threads. The result is as follows:
(3) We can see that a thread is waiting for the return of the loadurlfile method to see what the parameter value is. Run ~ 21 s switch to the waiting thread and run! Clrstack-
Omit a bunch of output, from the back to the following:
0e93ee04 7a5ad0a9 system. net. Connection. submitrequest (system. net. httpwebrequest)
Parameters:
This = 0x06c97120
Request = 0x06c96844
Locals:
0x0e93ee1c = 0x00000001
0x0e93ee18 = 0x00000000
<No data>
<No data>
<No data>
<No data>
<No data>
<No data>
(4) The request parameter of submitrequest should be the file address of the request .! Do 0x06c96844: The request contains the following content:
7a757bf0 4001f22 5C system. Uri 0 instance 06c967d0 _ URI
7a757bf0 4001f23 60 system. Uri 0 instance 06c967d0 _ originuri
790fd8c4 4001f24 64 system. String 0 instance 00000000 _ mediatype
790ffcc8 4001f25 1C system. int64 1 instance-1 _ contentlength
7a78e938 4001f26 68 system. net. iwebproxy 0 instance 06867e10 _ proxy
7a794fe8 4001f27 6C... Em. net. proxychain 0 instance 06c96ddc _ proxychain
790fd8c4 4001f28 70 system. String 0 instance 00000000 _ connectiongroupname
Run! Do06c967d0Check the URI value:
0: 021>! Do 06c967d0
Name: system. Uri
Methodtable: 7a757bf0
Eeclass: 7a757a3c
Size: 40 (0x28) bytes
(C: \ WINDOWS \ Assembly \ gac_msil \ System \ 2.0.0.0 _ b77a5c561934e089 \ system. dll)
Fields:
MT field offset type vt attr Value Name
790fd8c4 4001b51 C system. String 0 instance 06c96728 m_string
The package is really full. Sweat a bit. Continue! Do 06c96728
(5) it seemsProgramIs waiting for BBS ***/API /***. the pH address is returned. An interface for getting user scores is used on the webpage. The interface for testing environment is configured on a closed forum server. After modification, everything works normally.