开发者 发表于 2008-2-27 14:03:55

ACE_Asynch_Connector 的问题

在测试过程中,总是会出现这样的情况:

1.创建一个socket
2.去closesocket这个socket
3.在去重新申请一个socket,这时新创建的socket就会提示:
ACE_Asynch_Connector::handle_connect : Set blocking mode: handle is not a socket


这是什么原因!?

peakzhang 发表于 2008-2-27 15:07:20

看具体代码才好分析。

开发者 发表于 2008-2-27 18:09:32

谢谢,我解决了,不知道为什么在windows上面,因为先关闭一个socket,然后重新开启一个socket是前后执行的,如果连续执行就会有这个问题。
我现在改为需要close的socket等待5s后再closesocket(),这样就不会有问题了。

rosebush 发表于 2008-3-3 15:43:38

这个问题的核心是要保证closesocket调用的时候,所有异步事件都已经处理完了,否则是会出错的

等待5s就不出错,就是这个原因

开发者 发表于 2008-3-5 10:17:20

thank you !

开发者 发表于 2008-3-5 10:19:40

我朋友一个新的问题,下面的log是在程序dump后打印出来的,大家看看什么问题哦!

#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
#SIGSEGV (0xb) at pc=0x001e8117, pid=14727, tid=131500944
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0_09-b03 interpreted mode)
# Problematic frame:
# C_ZN36ACE_POSIX_Asynch_Write_Stream_Result8completeEjiPKvm+0x47
#

---------------T H R E A D---------------

Current thread is native thread

siginfo:si_signo=11, si_errno=0, si_code=1, si_addr=0xab8f0b54

Registers:
EAX=0xab8f0b50, EBX=0x0026cc04, ECX=0x00269d34, EDX=0x00000000
ESP=0x07d68170, EBP=0x07d681a8, ESI=0xa00f0dd0, EDI=0x00269d34
EIP=0x001e8117, CR2=0xab8f0b54, EFLAGS=0x00010212

Top of Stack: (sp=0x07d68170)
0x07d68170:   0026cc04 0026cc04 07d682a8 08d30698
0x07d68180:   07d68188 00295880 07d681a8 001e3d42
0x07d68190:   08d30e70 00000000 08d30e70 0026cc04
0x07d681a0:   a00f0dd0 00269d34 07d681d8 001f177f
0x07d681b0:   a00f0dd0 00000000 00000000 00000000
0x07d681c0:   00000020 a00f0dd0 08d30e70 0026cc04
0x07d681d0:   00000001 07d682a0 07d682b8 001f4b98
0x07d681e0:   08d30698 a00f0dd0 00000000 00000000

Instructions: (pc=0x001e8117)
0x001e8107:   00 8b 45 18 89 86 ac 00 00 00 8b 86 b0 00 00 00
0x001e8117:   01 50 04 8b 06 8d 7d e8 8b 50 bc 89 3c 24 8d 04

Stack: [0x07368000,0x07d69000),sp=0x07d68170,free space=10240k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C_ZN36ACE_POSIX_Asynch_Write_Stream_Result8completeEjiPKvm+0x47
C_ZN18ACE_POSIX_Proactor25application_specific_codeEP23ACE_POSIX_Asynch_ResultjPKvm+0x3f
C_ZN22ACE_POSIX_SIG_Proactor15handle_events_iEPK14ACE_Time_Value+0x1c8
C_ZN22ACE_POSIX_SIG_Proactor13handle_eventsEv+0x1c
C_ZN12ACE_Proactor13handle_eventsEv+0x25
C_ZN12ACE_Proactor23proactor_run_event_loopEPFiPS_E+0x125
C
C_ZN13ACE_Task_Base7svc_runEPv+0x56
C_ZN18ACE_Thread_Adapter8invoke_iEv+0x58
C_ZN18ACE_Thread_Adapter6invokeEv+0x66
Cace_thread_adapter+0x11
C


---------------P R O C E S S---------------

Java Threads: ( => current thread )
0x08dc9e68 JavaThread "Low Memory Detector" daemon
0x08dc8958 JavaThread "CompilerThread0" daemon
0x08dc79a0 JavaThread "Signal Dispatcher" daemon
0x08db8330 JavaThread "Finalizer" daemon
0x08db6508 JavaThread "Reference Handler" daemon

Other Threads:
0x08db3838 VMThread
0x08dcb430 WatcherThread

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap
def new generation   total 576K, used 378K [0xacd30000, 0xacdd0000, 0xad210000)
eden space 512K,63% used [0xacd30000, 0xacd80c60, 0xacdb0000)
from space 64K,86% used [0xacdc0000, 0xacdcdd08, 0xacdd0000)
to   space 64K,   0% used [0xacdb0000, 0xacdb0000, 0xacdc0000)
tenured generation   total 1408K, used 483K [0xad210000, 0xad370000, 0xb0d30000)
   the space 1408K,34% used [0xad210000, 0xad288ed0, 0xad289000, 0xad370000)
compacting perm gentotal 8192K, used 6019K [0xb0d30000, 0xb1530000, 0xb4d30000)
   the space 8192K,73% used [0xb0d30000, 0xb1310cf8, 0xb1310e00, 0xb1530000)
No shared spaces configured.

开发者 发表于 2008-3-5 10:21:39

而且我发现在acceptor执行ACE_Asynch_Write_Stream的write()之后,在ACE_Asynch_Write_Stream_Result里面的complete()参数里面的值突然的都没有了

开发者 发表于 2008-3-5 14:41:00

我问下哦,如何socket关闭,并释放了资源的话,运行的程序的内存使用会降低啊!?
页: [1]
查看完整版本: ACE_Asynch_Connector 的问题