PDA

View Full Version : [Solved] userEnter Chain.Fail error log question?



Cusco
08-19-2011, 11:30 AM
Hi tcarr

I am sending a join room quest about below error message

the persistent room created by Server-Lvl plugin

once the user sending join room request to a persistent room and add on plugin EventHandler

if response is Chain Fail I got below fail log?


2011-Aug-19 06:25:07:375 [worker-12 BinaryTCP-0] DEBUG com.electrotank.electroserver5.entities.PeopleImpl - Starting People.login for 227335442161691 / Tester
2011-Aug-19 06:25:07:387 [worker-12 BinaryTCP-0] DEBUG com.electrotank.electroserver5.entities.PeopleImpl - User not already logged in, attempting event handlers (if available)
2011-Aug-19 06:25:07:394 [worker-12 BinaryTCP-0] DEBUG Extensions.DatabaseWithJDBCLite.ManagedObjectFacto ries.ActiveRecordPool - SELECT SQL_CACHE `id`, `username`, `lastlogin`, `ipaddress` FROM `auth` WHERE `username` = 'Tester' AND `password` = '1eeb7f9b69df03ab788f46395a7aecf0547d7fc1' LIMIT 1
2011-Aug-19 06:25:07:411 [worker-12 BinaryTCP-0] DEBUG Extensions.DatabaseWithJDBCLite.EventHandlers.Data baseLoginHandler - User 1 : Tester logged in ( 168.70.96.27 )
2011-Aug-19 06:25:07:414 [worker-12 BinaryTCP-0] DEBUG Extensions.DatabaseWithJDBCLite.EventHandlers.Data baseLoginHandler - Update IP Address Affected Row: 1
2011-Aug-19 06:25:07:419 [worker-12 BinaryTCP-0] DEBUG com.electrotank.electroserver5.entities.PeopleImpl - User Logged In 227335442161691 / Tester
2011-Aug-19 06:25:07:434 [worker-12 BinaryTCP-0] WARN com.electrotank.electroserver5.entities.managers.D efaultExtensionManager - userDidLogin attempt for: DatabaseWithJDBCLite
2011-Aug-19 06:25:07:436 [worker-12 BinaryTCP-0] DEBUG Extensions.World Zone.Plugins.Ashinata - interop requests: {EsObject:
srq:string = wd
}
2011-Aug-19 06:25:07:438 [worker-12 BinaryTCP-0] DEBUG Extensions.DatabaseWithJDBCLite.EventHandlers.Data baseLoginHandler - {EsObject:
wzid:integer = 0
wrid:integer = 0
seed:string = GRJ1J779
}
2011-Aug-19 06:25:07:438 [worker-12 BinaryTCP-0] DEBUG Extensions.DatabaseWithJDBCLite.EventHandlers.Data baseLoginHandler - User Tester logged in
2011-Aug-19 06:25:07:847 [worker-17 BinaryTCP-0] DEBUG Extensions.World Zone.Plugins.ZoneBaseEventHandler - Tester ENTERING...
2011-Aug-19 06:25:07:849 [worker-17 BinaryTCP-0] WARN com.electrotank.electroserver5.entities.managers.R oomEventFactory - Sending error UserNotJoinedToRoom for JoinRoomRequest
com.electrotank.electroserver5.entities.exceptions .JoinRoomException
at com.electrotank.electroserver5.entities.managers.R oomManager.joinRoom(RoomManager.java:640)
at com.electrotank.electroserver5.entities.managers.R oomManager.joinRoom(RoomManager.java:576)
at com.electrotank.electroserver5.entities.managers.R oomManager.joinRoom(RoomManager.java:525)
at com.electrotank.electroserver5.servers.registry.tr ansactions.JoinRoomTransaction.execute(JoinRoomTra nsaction.java:23)
at com.electrotank.electroserver5.servers.registry.tr ansactions.SinglePersonTransaction.execute(SingleP ersonTransaction.java:34)
at com.electrotank.electroserver5.servers.registry.tr ansactions.SinglePersonTransaction.execute(SingleP ersonTransaction.java:16)
at com.electrotank.electroserver5.servers.registry.tr ansactions.TransactionHandlerImpl.processMessage(T ransactionHandlerImpl.java:170)
at com.electrotank.electroserver5.servers.registry.Re gistryEndpoint.doReceive(RegistryEndpoint.java:213 )
at com.electrotank.electroserver5.servers.registry.Re gistryEndpoint.receive(RegistryEndpoint.java:97)
at com.electrotank.electroserver5.servers.gateway.Gat ewayEndpoint.write(GatewayEndpoint.java:74)
at com.electrotank.electroserver5.servers.gateway.Gat ewayEndpoint.write(GatewayEndpoint.java:86)
at com.electrotank.electroserver5.servers.gateway.tra nsactions.ClientMessageToRegistryForwarder.forward (ClientMessageToRegistryForwarder.java:31)
at com.electrotank.electroserver5.protocol.etio.Elect roServerMessageProcessor.forward(ElectroServerMess ageProcessor.java:112)
at com.electrotank.electroserver5.protocol.etio.Elect roServerMessageProcessor.onMessage(ElectroServerMe ssageProcessor.java:52)
at com.electrotank.electroserver5.protocol.etio.Elect roServerMessageProcessor.onMessage(ElectroServerMe ssageProcessor.java:28)
at org.jetlang.channels.MemoryChannel.publish(MemoryC hannel.java:27)
at com.electrotank.electroserver5.protocol.etio.tcp.T CPDecoder.readMessage(TCPDecoder.java:72)
at com.electrotank.io.ReadOneMessage.onMessage(ReadOn eMessage.java:33)
at com.electrotank.io.ReadOneMessage.onMessage(ReadOn eMessage.java:1)
at org.jetlang.channels.MemoryChannel.publish(MemoryC hannel.java:27)
at com.electrotank.io.CheckForReadReadiness.read(Chec kForReadReadiness.java:78)
at com.electrotank.io.CheckForReadReadiness.onMessage (CheckForReadReadiness.java:45)
at com.electrotank.io.CheckForReadReadiness.onMessage (CheckForReadReadiness.java:1)
at org.jetlang.channels.ChannelSubscription$1.run(Cha nnelSubscription.java:31)
at java.util.concurrent.ThreadPoolExecutor$Worker.run Task(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (Unknown Source)
at java.lang.Thread.run(Unknown Source)

tcarr
08-19-2011, 12:23 PM
That is normal. If plugins are in the habit of returning ChainAction.Fail, then on a production server you would just set your logging level for RoomEventFactory to ERROR instead of WARN. notice that this is a warning, not an error.

Cusco
08-19-2011, 12:51 PM
Oh~ Thank you ~

Cusco
08-19-2011, 03:22 PM
is a Join Room Event can't pass extra params in to context?

tcarr
08-19-2011, 04:07 PM
If a plugin wants to tell a user why it is failing the join room, that's easy. Just have the plugin send a plugin event to the user. The user has to be listening for plugin events of course.

Cusco
08-19-2011, 04:11 PM
I mean when I send a JoinRoomEvent to userEnter
Can I send extra param to userEnter?

Cusco
08-19-2011, 04:18 PM
what is the UserEnterContext.getResponseParameters() & UserEnterContext.setResponseParameters() can be use for ? Thanks!


// The response esob can be read by the client from the LoginResponse. ( so same as UserEnter )

tcarr
08-19-2011, 04:33 PM
Ah I hadn't noticed that before. Looking at the api source code, this should be added to the GenericErrorResponse that is sent to the client. That EsObject would be the extraData attribute on the GenericErrorResponse.

Cusco
08-20-2011, 07:54 AM
hmm.. I can't found that GenericErrorResponse in C# Api (can't catch response on JoinZoneEvent and JoinRoomEvent)
which Event/Response handler will it sent to the client? Thanks~

and what if I response ChainAction.OkAndStop in userEnter? What will it passed to next?



@Override
public ChainAction userEnter(UserEnterContext context) {
String userName = context.getUserName();
EsObject response = new EsObject();
logger.debug( LoginInfo.toString() );

EsObject internalExchange = new EsObject();
internalExchange.setString(InteropExchange.SERVERR EQUEST, InteropExchange.ZONING);
internalExchange.setString(InteropExchange.USERNAM E , userName);
EsObject getUserZoneInfo = getApi().callServerPlugin(getApi().getZoneName(), internalExchange);
logger.debug(userName + " ENTERING...");
boolean canZone = getUserZoneInfo.getBoolean(InteropExchange.ZONING, false);
if ( canZone ) {
logger.debug(userName + " have token zoning to " + getApi().getRoomName() );
response.setString(ZoneExchange.ZONEXCHANGE, ZoneExchange.SUCCESS);
return ChainAction.OkAndContinue;
}

if (getApi().isUserLoggedIn(userName)) {
logger.debug(userName + " failed zoning to " + getApi().getRoomName() );

getApi().evictUserFromServer(userName, null);

EsObject ClearUpUserMemoryBuffer = new EsObject();
ClearUpUserMemoryBuffer.setString(InteropExchange. SERVERREQUEST, InteropExchange.REMOVE);
ClearUpUserMemoryBuffer.setString(InteropExchange. USERNAME , userName);
getApi().callServerPlugin(getApi().getZoneName(), ClearUpUserMemoryBuffer);
}
// default Chain Fail
response.setString(ZoneExchange.ZONEXCHANGE, ZoneExchange.FAIL);
return ChainAction.Fail;
}

tcarr
08-20-2011, 10:51 AM
If a client fails to join a room, the server sends a GenericErrorResponse. The C# api doc on it is here (http://www.electrotank.com/docs/es5/client/csharp/class_electrotank_1_1_electroserver5_1_1_api_1_1_g eneric_error_response.html).

Cusco
08-20-2011, 01:07 PM
Thank you, very nice !!




Generic Error: RegistryTransactionEncounteredError
UnityEngine.Debug:Log(Object)
NetworkConnectionManager:OnGenericErrorResponse(Ge nericErrorResponse) (at Assets/_Script/_Networking/NetworkConnectionManager.cs:264)
System.Delegate:DynamicInvoke(Object[])
Electrotank.Electroserver5.Core.EsEngineDefault:Ra ise(EsMessage)
Electrotank.Electroserver5.Core.EsEngineDefault:_D ispatch()
Electrotank.Electroserver5.Core.EsEngineDefault:Di spatch()
NetworkConnectionManager:FixedUpdate() (at Assets/_Script/_Networking/NetworkConnectionManager.cs:60)

Cusco
08-20-2011, 01:10 PM
but Debug.Log ( "Generic Error: " + evt.ErrorType.ToString() + evt.ExtraData.ToString() );
can't get the ExtraData?



NullReferenceException: Object reference not set to an instance of an object
NetworkConnectionManager.OnGenericErrorResponse (Electrotank.Electroserver5.Api.GenericErrorRespon se evt) (at Assets/_Script/_Networking/NetworkConnectionManager.cs:264)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters)
System.Delegate.DynamicInvokeImpl (System.Object[] args)
System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args)
System.Delegate.DynamicInvoke (System.Object[] args)
Electrotank.Electroserver5.Core.EsEngineDefault.Ra ise (Electrotank.Electroserver5.Api.EsMessage message)
Electrotank.Electroserver5.Core.EsEngineDefault._D ispatch ()
Electrotank.Electroserver5.Core.EsEngineDefault.Di spatch ()

Cusco
08-20-2011, 01:21 PM
I better to try Plugin Message instead~ Thank again~

tcarr
08-20-2011, 01:24 PM
Odds are that the extra data is an EsObjectRO, and there might not be a toString() for that in the C# api. Make an EsObject, use addAll to merge the extra data to it, then toString it. See if that works.

Or just use a plugin message, which is what I've always done when the client needed to know why it wasn't allowed in the room.

Oh wait - if the error is RegistryTransactionEncounteredError then it's not the plugin that is failing the join, it's some other reason. Is there anything in your server logs for this?

Cusco
08-20-2011, 01:33 PM
that maybe my coding error in "getApi().evictUserFromServer(userName, null);"
the user kicked out before Chain.Fail ~~



if (getApi().isUserLoggedIn(userName)) {
logger.debug(userName + " failed zoning to " + getApi().getRoomName() );

getApi().evictUserFromServer(userName, null);

EsObject ClearUpUserMemoryBuffer = new EsObject();
ClearUpUserMemoryBuffer.setString(InteropExchange. SERVERREQUEST, InteropExchange.REMOVE);
ClearUpUserMemoryBuffer.setString(InteropExchange. USERNAME , userName);
getApi().callServerPlugin(getApi().getZoneName(), ClearUpUserMemoryBuffer);
}
// default Chain Fail
response.setString(ZoneExchange.ZONEXCHANGE, ZoneExchange.FAIL);
return ChainAction.Fail;

Cusco
08-20-2011, 01:39 PM
it works =D



Generic Error: UserNotJoinedToRoomFalse
UnityEngine.Debug:Log(Object)
NetworkConnectionManager:OnGenericErrorResponse(Ge nericErrorResponse) (at Assets/_Script/_Networking/NetworkConnectionManager.cs:264)
System.Delegate:DynamicInvoke(Object[])
Electrotank.Electroserver5.Core.EsEngineDefault:Ra ise(EsMessage)
Electrotank.Electroserver5.Core.EsEngineDefault:_D ispatch()
Electrotank.Electroserver5.Core.EsEngineDefault:Di spatch()
NetworkConnectionManager:FixedUpdate() (at Assets/_Script/_Networking/NetworkConnectionManager.cs:60)

andrewt
12-13-2011, 11:13 PM
Yes, but what if there is no error and you just want to send an esobject back to the client after they join a room?

tcarr
12-13-2011, 11:22 PM
If you want to send an EsObject to the user *after* they have joined a room, you can using the plugin's userDidEnter method and send a plugin message with the EsObject. If you send a plugin message in the plugin's userEnter method, then the client will get the message before the JoinRoomEvent.