Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question

Remoting serivce route incorrectly?


I have this method in my remoting interface:

void create(@Routing("getId") User user);

getId returns a java.lang.Long object.

If I invoke this method with an id that's something low, for example 100, everything works great. The end object is created and returns correctly.

If the id is really high, for example 6986832704440059829, I get an error later in the stack when I try to create the object in the space. It tells me that the object should not be in this partition.

Here is the exact message:

Operation is rejected - the routing value in the written entry of type 'com.company.User' does not match this space partition id. The value within the entry's routing property named 'id' is 6986832704440059829 which matches partition id 2 while current partition id is 1.

So far, we have done a workaround by creating wrapper classes around Long/Integer and also Strings(they suffer from this as well) and implementing a custom hashCode(java.util.Objects.hash).

But this worwkaround feels wrong. java.lang.Long for example should work with any value.

So my question is, is this a bug? If so, will it be fixed? Or am I doing something wrong?

asked 2017-09-12 09:49:20 -0500

GS_User's avatar

updated 2018-01-16 07:36:48 -0500

edit retag flag offensive close merge delete

4 Answers

Sort by ยป oldest newest most voted

Hi, This error is intended to protect from writing to embedded space with wrong routing value, that will make client not able to find the object.If the write is indeed done from embedded space the space proxy should be used to route the object to the right partition,Otherwise if the routing key type is user defined the hashcode method should be checked.

The way we calculate partition number in general is : safeAbs(routingValue.hashCode()) % numOfPartitions; But Long routing keys are handled a bit differently ((int) (safeAbs((Long) routingValue) % numOfPartitions) where we have implementation for long for safeAbs) So regarding the Long keys please report a support case and we will further investigate.

Thanks, Ester.

answered 2018-01-17 01:56:26 -0500

Ester's avatar
edit flag offensive delete link more


I am well aware that an entity must be saved in the correct partition in order for it to be retrieved. Otherwise it's forever lost, so we are on the same track here. My question is whyit's routed to the wrong partition. We are using space based remoting: https://docs.gigaspaces.com/xap/9.7/d... The @Routing annotation ensures that the entity is routed to the correct partition. This works if the ID entity is an object. If I for example use java.lang.Long and the value is high, the @Routing fail to route correctly. I have multiple colleague reproducing this and I'll try to upload a sample project.

GS_User's avatar GS_User  ( 2018-01-17 03:40:28 -0500 )edit

Hi, We added a fix particularly for Long routing since we add an issue in initial load, It could be that the fix wasn't done in remote service routing, to validate it you can try to disable that change by setting com.gs.disable-precise-long-routing to true please let us know if that solves the issue or not.

Thanks, Ester.

Ester's avatar Ester  ( 2018-01-18 02:18:17 -0500 )edit

Hi! Setting property com.gs.disable-precise-long-routing to true resolves indeed our issues. The space based remoting routes correctly with that flag set to true. Thanks!

GS_User's avatar GS_User  ( 2018-01-18 09:42:24 -0500 )edit

Thanks for the update, so this indeed seems a bug, Please report a support case for this so we will be able to update you once its fixed and supply a patch if required, The drawback of using com.gs.disable-precise-long-routing property is in case you use initial load from data base in this case for large Longs(> max value of int) the routing wasn't calculated right.see GS-12461 If you don't have initial load you can safely use this property.

Ester's avatar Ester  ( 2018-01-21 02:36:52 -0500 )edit

Sure! Where do we report bugs?

GS_User's avatar GS_User  ( 2018-01-23 03:09:09 -0500 )edit

Hi, Which version are you using? Similar issue was fixed in 11 version.

Regards, Ester.

answered 2017-09-17 06:39:38 -0500

Ester's avatar
edit flag offensive delete link more


I am using version 12 and me and my colleague are still suffering from this.

Basically, having java.lang.Long as id won't work. You must wrap it inside an object.

FIrst, the object is routed at the remote interface. Then, before saving to the space, GS makes a check to ensure the object is saved on the correct partition. That check fails somehow.

GS_User's avatar GS_User  ( 2018-01-16 07:34:47 -0500 )edit

Here is an explanation of the error.


answered 2018-01-16 08:11:47 -0500

Dixson Huie's avatar
edit flag offensive delete link more


Without looking to closely on that, it's unrelated to this issue. I am aware that an entity must be saved in the right partition in order for it to be retrieved. This question is about why the entity is routed incorrectly. It's about why the entity is routed to the incorrect partition if the id is of type java.lang.Long(or Integer).

GS_User's avatar GS_User  ( 2018-01-16 08:28:16 -0500 )edit

I using 12.1.0 version.

I have a CompositeKey (with 8 properties) as SpaceId and implemented hashCode method in the CompositeKey.

With this setup, I'm facing similar problem. Her's the exception that I got:

com.gigaspaces.client.protective.ProtectiveModeException: Operation is rejected - the routing value in the written entry of type 'com.myweb.MySpaceEntity' does not match this space partition id. The value within the entry's routing property named 'compositeKey' is 7313b4cf-b0a7-4e48-84cc-45d5d061b039|8767|YY|XYZ|1|AS9872|2017-11-22|X which matches partition id 1 while current partition id is 2.

answered 2017-11-08 19:15:02 -0500

VJS's avatar
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2017-09-12 09:49:20 -0500

Seen: 742 times

Last updated: Jan 17 '18