[SOLVED][WTF]Server restart with no reason << INFINITE LOOP
Options
hi,
for an unknown reason the server restart by itself maybe i have done something wrong.
with photon v3-0-19-2868-RC8
here is my code:
the code of the constructor: of Proto.Operations.Kick:
the code of the operation threatment:
then the create operation response code:
and what vs2010 attached debugger says:
here is the photon server log:
i just want to know what im doing wrong and if the problem comes from my code or a problen due to photon
EDIT: i forget to precise that the problem comes when r.Name is equal to this.NickName (those variables are valid string).
for an unknown reason the server restart by itself maybe i have done something wrong.
with photon v3-0-19-2868-RC8
here is my code:
the code of the constructor: of Proto.Operations.Kick:
public Kick(OperationRequest request) { this._operationCode = request.OperationCode; if (request.Parameters.Count != 2) { this._isValid = false; this._returnCode = (short)Proto.ErrorCodes.Type.InvalidParametersNumber; this._returnMessage = "to much or not enough parameters"; } this.Name = request.Parameters[0] as string; this.Reason = request.Parameters[1] as string; if (null == this.Name || null == this.Reason) { this._isValid = false; this._returnCode = (short)Proto.ErrorCodes.Type.InvalidParametersType; this._returnMessage = "one or more parameters are in a wrong type"; } }
the code of the operation threatment:
private void OpKick(OperationRequest operationRequest, SendParameters sendParameters) { var r = new Proto.Operations.Kick(operationRequest); if (r.IsValid) { if (r.Name != this.NickName) { if (!RoomManager.GetInstance().KickPlayer(r.Name, r.Reason, this)) r.ReturnCode = 1; } else r.ReturnCode = 1; } this.SendOperationResponse(r.CreateOperationResponse(new Dictionary<byte, object>()), sendParameters); }
then the create operation response code:
public Photon.SocketServer.OperationResponse CreateOperationResponse(Dictionary<byte, Object> parameters) { var r = new OperationResponse(this._operationCode, parameters); r.ReturnCode = this._returnCode; r.DebugMessage = this._returnMessage; return r; }
and what vs2010 attached debugger says:
A first chance exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll
The thread 'ThreadFiber-1' (0xb00) has exited with code 0 (0x0).
A first chance exception of type 'System.NullReferenceException' occurred in PhotonHostRuntime.DLL
A first chance exception of type 'System.Exception' occurred in PhotonHostRuntime.DLL
here is the photon server log:
3492: 12:15:35.963 - CManagedHost::OnStackOverflow()
3604: 12:15:36.065 - CManagedHost::OnDomainUnload() - 5
3604: 12:15:36.065 - Restarting application: "Phtn3srv" due to unexpected unload
3604: 12:15:36.065 - Application: "Phtn3srv" restart request (abort existing connections)
3604: 12:15:37.393 - Application: "Phtn3srv" started in app domain: 6
3604: 12:15:37.564 - Application: "Phtn3srv" stopped in app domain: 5 (abort existing connections)
3604: 12:15:37.564 - Application: "Phtn3srv" restart complete.
i just want to know what im doing wrong and if the problem comes from my code or a problen due to photon
EDIT: i forget to precise that the problem comes when r.Name is equal to this.NickName (those variables are valid string).
0
Comments
-
Hard to say whats going wrong. From the exception i expect that one of the provided string is null (A first chance exception of type 'System.NullReferenceException' occurred in PhotonHostRuntime.DLL).
You should put a try catch around the code in your OpKick method to get more details about the exception.0 -
Nothing in my code is null everything is valid the exception is throw under photon when im sending an operation response and the thread is cancelled into photon so i cannot catch anything the server just reboot maybe its a probem in my funtion
CreateOperationResponse
I realy dont know how to fix this and if it's my fault what im doing wrong.
Just another question to the photon developpers: are the peers runned into a thread context maybe it come from that.
EDIT: in fact the server reload the domain when the operationresponse return code is different from 0;0 -
Are there any information about the exception in PhotonCLR.log file ?0
-
nope there is nothing in photon clr log
i attached it i add my log and photon instance log too.
My log4net.config (in the case if im missing something im my log):<?xml version="1.0" encoding="utf-8" ?> <log4net debug="false"> <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender"> <layout type="log4net.Layout.PatternLayout"> <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p %-30.30c{2} %m% [%t] [%x]%n" /> </layout> </appender> <!-- "normal" log file appender --> <appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender"> <param name="File" value="log\Phtn3srv.log" /> <param name="AppendToFile" value="true" /> <param name="MaxSizeRollBackups" value="2" /> <param name="MaximumFileSize" value="250MB" /> <param name="RollingStyle" value="Size" /> <param name="LockingModel" type="log4net.Appender.FileAppender+MinimalLock" /> <layout type="log4net.Layout.PatternLayout"> <param name="ConversionPattern" value="%d [%t] %-5p %c [%x] - %m%n" /> </layout> </appender> <!-- performance counter log file appender --> <appender name="CounterAppender" type="log4net.Appender.RollingFileAppender"> <param name="File" value="log\Phtn3srvCounter.log" /> <param name="AppendToFile" value="true" /> <param name="MaxSizeRollBackups" value="1" /> <param name="MaximumFileSize" value="1MB" /> <param name="RollingStyle" value="Size" /> <param name="StaticLogFileName" value="true" /> <param name="LockingModel" type="log4net.Appender.FileAppender+MinimalLock" /> <layout type="log4net.Layout.PatternLayout"> <param name="ConversionPattern" value="%d{ABSOLUTE} %m%n" /> </layout> </appender> <!-- logger --> <root> <level value="DEBUG" /> <appender-ref ref="LogFileAppender" /> <appender-ref ref="ConsoleAppender" /> </root> <!-- operation data logger --> <!-- set level to DEBUG to enable operation data logging--> <logger name="OperationData" additivity="false"> <level value="DEBUG" /> <appender-ref ref="LogFileAppender" /> </logger> <!-- performance counter logger --> <!-- set level to DEBUG to enable performance counter logging--> <logger name="PerformanceCounter" additivity="false"> <level value="DEBUG" /> <appender-ref ref="CounterAppender" /> </logger> <logger name="ExitGames.Diagnostics.Monitoring.CounterSampleSender" additivity="false"> <level value="INFO" /> <appender-ref ref="CounterAppender" /> </logger> </log4net>
my log (sry cannot upload it):2012-02-28 17:22:58,360 [6] DEBUG OperationData [(null)] - OnInit - ConnID=3, data=(41 bytes) F3-00-01-06-01-03-00-00-07-50-68-74-6E-33-53-72-76-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 2012-02-28 17:22:58,362 [6] DEBUG Photon.SocketServer.ApplicationBase [(null)] - OnInit - ConnID=3, IP 10.15.193.231 on port 5055 2012-02-28 17:22:58,364 [6] DEBUG Photon.SocketServer.Protocol [(null)] - Parsed init message for application Phtn3Srv, client version 3.0.0, protocol version 1.6 2012-02-28 17:22:58,367 [6] DEBUG Phtn3srv.Phtn3srvPeer [(null)] - New peer created 2012-02-28 17:22:58,368 [6] DEBUG Photon.SocketServer.ApplicationBase [(null)] - OnInit - response sent to ConnId 3 with SendResult Ok 2012-02-28 17:22:58,370 [6] DEBUG OperationData [(null)] - OnInit - ConnID=3, send data=(3 bytes) F3-01-00 2012-02-28 17:22:58,438 [6] DEBUG OperationData [(null)] - OnReceive - ConnID=3, data=(107 bytes) F3-06-00-00-01-01-78-00-00-00-60-6F-2E-D1-BD-FC-63-8D-A1-9C-63-7F-26-7D-5C-63-38-AA-A9-D2-DF-7D-E1-2D-84-E3-CE-0E-CB-71-EC-B3-DF-0F-C1-2B-AA-57-AF-BA-20-9A-E9-E7-A9-F3-CD-C5-10-36-7B-E1-94-52-4E-E3-75-E3-FF-47-6B-F1-ED-1F-C3-10-36-EF-35-5A-34-BE-8D-66-CA-8D-D2-C8-BF-14-B7-E9-84-26-54-B9-86-98-61-96-E7-18-71-65-FA-16-F1 2012-02-28 17:22:58,445 [17] DEBUG Photon.SocketServer.PeerBase [(null)] - InitializeEncryption: conId=3, HashMode=SHA256, Paddin=PKCS7 2012-02-28 17:22:58,446 [17] DEBUG OperationData [(null)] - SentOpResponse: ConnID=3, opCode=0, return=0, ChannelId=0, result=Ok, data=(110 bytes) F3-07-00-00-00-2A-00-01-01-78-00-00-00-60-6C-58-66-B8-76-C7-8F-28-77-B0-44-8D-2A-9B-EA-A4-AE-3C-1F-FA-DD-05-C1-7C-E9-37-72-E0-46-5F-F5-B5-67-58-03-9A-C1-D5-22-9E-3E-E6-BC-D1-31-F5-E0-A8-05-3C-E8-BB-75-68-52-42-E5-61-F8-33-75-45-88-FB-F3-DE-13-EB-A5-92-91-7C-45-3C-C1-12-B1-78-C8-9F-6A-B9-B7-A1-C2-01-BD-91-D3-9B-84-D3-C4-E4-DB-31 2012-02-28 17:23:02,205 [6] DEBUG OperationData [(null)] - OnReceive - ConnID=3, data=(16 bytes) F3-02-00-00-02-00-73-00-03-6D-75-79-01-73-00-00 2012-02-28 17:23:02,206 [12] DEBUG Phtn3srv.Phtn3srvPeer [(null)] - Peer ask for something opcode[0] 2012-02-28 17:23:02,208 [12] DEBUG Phtn3srv.Phtn3srvPeer [(null)] - login asked 2012-02-28 17:23:02,973 [3] DEBUG Phtn3srv.Phtn3srvApplication [(null)] - Server successfully started 2012-02-28 17:23:02,994 [3] DEBUG Phtn3srv.Lobby.RoomManager [(null)] - Getting RoomManagerInstance 2012-02-28 17:23:02,997 [3] DEBUG Phtn3srv.Lobby.RoomManager [(null)] - RoomManager Created 2012-02-28 17:23:03,004 [3] INFO Photon.SocketServer.ApplicationBase [(null)] - Application start: AppId=Phtn3srv; AppPath=C:\Users\{Dark-Platypus}\Documents\Visual Studio 2010\Projects\Phtn3srv\Phtn3srv
0 -
Massou wrote:maybe its a probem in my funtion
Your code looks correct.
I'am currently trying to simulate your OperationResponse in my local machine with the following code.var r = new OperationResponse(0, new Dictionary<byte, object>()); r.ReturnCode = 1; r.DebugMessage = null; this.SendOperationResponse(r, sendParameters); return;
Unfortunately no exception occurs on my machine.
Are these the parameters which are set when you send the operation response ?0 -
yeah it's what im sending but i have a class who do that with this line:
this.SendOperationResponse(r.CreateOperationResponse(new Dictionary<byte, object>()), sendParameters);
this is in my custom peer class who inherits from PeerBase.
i construct a class who generate the operations response : Proto.Operations.Kick (in order to avoid numerous line of code in a same file).
but the content in the OperationResponse generated is valid.
I have tested with your code suggestion and is the same problem.0 -
Which version of PhotonSocketServer are you using (bin_Win32, bin_Win64, ect. ) ?
And which protocol is used (Udp, Tcp) ?0 -
im using bin_Win32 in a 64 bit os and i use UDP.0
-
Hi, i'm on the same team as Massou, on the client side we use: Photon3Unity3D.dll 3.0.1.2
The callback generated on the client is:@: public void OnStatusChanged (StatusCode statusCode)
case StatusCode.DisconnectByServerLogic: { Debug.Log("OFFLINE [3]"); _isConnected = false; break; }
Edit: my peer is initialized like this:_peer = new PhotonPeer(this, ConnectionProtocol.Udp);
If it may help Thanks in advance0 -
Is there a way to solve this problem? and are we the only persons using photon having this?0
-
For this particular issue, yes, you are the only persons who got this. At the moment, we have no other crashes to investigate and it's really hard to say anything until we could reproduce the issue.
Would you zip your projects and make them available to us? You could remove anything that's not necessary to reproduce this but should make sure we have client and server code that causes this issue.
This would help tremendously.0 -
Ok we're building you a light solution.0
-
Where can we send the client and the server because i cannot pm the exitgames team0
-
Send this to developer@exitgames.com0
-
We found the BUG :evil:
public short ReturnCode { get { return this._returnCode; } set { this.ReturnCode = value; } }
The setter of this property calls himself which results in an infinite loop.
This is the reason why you were not able to catch the exception. The .Net runtime throws a StackOverflow exception which cannot catched.
See the MSDN documentation for more information.
http://msdn.microsoft.com/en-us/library ... n(v=vs.100).aspx
Starting with the .NET Framework version 2.0, a StackOverflowException object cannot be caught by a try-catch block and the corresponding process is terminated by default.0 -
Thanks for your reactivity
Problem solveed.0 -
Thanks you very much0