Correct usage of unique() indexes on Titan : PermanentLockingException - multithreading

Update based on later experiments :
Initially I assumed that the PermanentLockingException was due to my usage of unique indices with locking. I removed this unique() property from my index graph configuration and I still run into the same PermanentLockingException.
To clarify, I have two separate indices and I'm trying to update the two of them concurrently. I'm not trying to update the same index from two threads and running into this issue.
This indicates to me that regardless of the index type, some kind of a global lock is obtained by Titan for every index-based transaction ? This means that at any given time Titan can update only one index tree ?
Is this correct ?
Thanks
I'm using Titan 1.0.0 with Cassandra backend. I created two composite indexes on Titan :
index1 = mgmt.buildIndex(indexName, Vertex.class).
addKey(indexPropertyKey1).addKey(indexPropertyKey2).unique()
.buildCompositeIndex();
index2 = mgmt.buildIndex(indexName, Vertex.class).
addKey(indexPropertyKey1).addKey(indexPropertyKey3).unique()
.buildCompositeIndex();
My intent behind doing this is to ensure that there is exactly only 1 entry in the backend with Key1+Key2 composite combination. I dont want any duplicates. I want to enforce the same thing with index2.
My understanding was that these are two different index constructs so they should not run into any conflict between each other. But I notice that when I'm trying to do a concurrent access/update on index1 and index2, I get a locking.PermanentLockingException from Titan. If access them serially I don't run into any trouble.
Some questions I have :
Is my usage of unique() correct ?
I'm not explicitly setting ConsistencyModifier.LOCK, so I'm assuming this is getting set by default to true by some other layer ? Does it matter one way or the other ?
These are two different indexes. So their access should be mutually exclusive. Am I missing something here ?
They do share one of the property keys, key1, does that matter ?
How can I allow concurrent access of these two different indices ? Can I allow this explicitly ? What does it cost ?
Thanks
Here is the error in-case someone is interested :
2016-09-01T12:17:19.29-0700 [App/0] OUT [Z: C:] 2016-09-01 19:17:19 ERROR [pool-30-thread-1] c.t.t.g.d.StandardTitanGraph [StandardTitanGraph.java:695] Could not commit transaction [8] due to storage exception in system-commit
2016-09-01T12:17:19.29-0700 [App/0] OUT com.thinkaurelius.titan.core.TitanException: Could not execute operation due to backend exception
2016-09-01T12:17:19.29-0700 [App/0] OUT at com.thinkaurelius.titan.diskstorage.util.BackendOperation.execute(BackendOperation.java:44)
2016-09-01T12:17:19.29-0700 [App/0] OUT at com.thinkaurelius.titan.diskstorage.keycolumnvalue.cache.CacheTransaction.persist(CacheTransaction.java:87)
2016-09-01T12:17:19.29-0700 [App/0] OUT at com.thinkaurelius.titan.diskstorage.keycolumnvalue.cache.CacheTransaction.flushInternal(CacheTransaction.java:141)
2016-09-01T12:17:19.29-0700 [App/0] OUT at com.thinkaurelius.titan.diskstorage.keycolumnvalue.cache.CacheTransaction.commit(CacheTransaction.java:198)
2016-09-01T12:17:19.29-0700 [App/0] OUT at com.thinkaurelius.titan.diskstorage.BackendTransaction.commit(BackendTransaction.java:135)
2016-09-01T12:17:19.29-0700 [App/0] OUT at com.thinkaurelius.titan.graphdb.database.StandardTitanGraph.commit(StandardTitanGraph.java:692)
2016-09-01T12:17:19.29-0700 [App/0] OUT at com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx.commit(StandardTitanTx.java:1352)
2016-09-01T12:17:19.29-0700 [App/0] OUT at com.thinkaurelius.titan.graphdb.tinkerpop.TitanBlueprintsGraph$GraphTransaction.doCommit(TitanBlueprintsGraph.java:263)
2016-09-01T12:17:19.29-0700 [App/0] OUT at org.apache.tinkerpop.gremlin.structure.util.AbstractTransaction.commit(AbstractTransaction.java:94)
2016-09-01T12:17:19.29-0700 [App/0] OUT at com.ge.predix.acs.privilege.management.dao.GraphGenericRepository.save(GraphGenericRepository.java:113)
2016-09-01T12:17:19.29-0700 [App/0] OUT at com.ge.predix.acs.privilege.management.dao.ResourceMigrationManager.doResourceMigration(ResourceMigrationManager.java:52)
2016-09-01T12:17:19.29-0700 [App/0] OUT at com.ge.predix.acs.privilege.management.dao.ResourceMigrationManager.run(ResourceMigrationManager.java:34)
2016-09-01T12:17:19.29-0700 [App/0] OUT at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
2016-09-01T12:17:19.29-0700 [App/0] OUT at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
2016-09-01T12:17:19.29-0700 [App/0] OUT at java.lang.Thread.run(Thread.java:745)
2016-09-01T12:17:19.29-0700 [App/0] OUT Caused by: com.thinkaurelius.titan.diskstorage.locking.PermanentLockingException: Expected value mismatch for KeyColumn [k=0x 16-165-160-114-116- 30- 97-116-116-114-105- 98-117-116-101-243, c=0x 0]: expected=[] vs actual=[120-133] (store=graphindex)

Related

Hitting Linux Kernel bug: Socket accept failed. Duplicate Socket connection on Heorku machine

This is the known issue which has been fixed:
2022-06-11 11:00:30.210 ERROR 4 --- [-33089-Acceptor] org.apache.tomcat.util.net.Acceptor : Socket accept failed
2022-06-11T11:00:30.210540+00:00 app[web.1]:
2022-06-11T11:00:30.210540+00:00 app[web.1]: java.io.IOException: Duplicate accept detected. This is a known OS bug. Please consider reporting that you are affected: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1924298
2022-06-11T11:00:30.210541+00:00 app[web.1]: at org.apache.tomcat.util.net.NioEndpoint.serverSocketAccept(NioEndpoint.java:545) ~[tomcat-embed-core-9.0.56.jar!/:na]
2022-06-11T11:00:30.210541+00:00 app[web.1]: at org.apache.tomcat.util.net.NioEndpoint.serverSocketAccept(NioEndpoint.java:78) ~[tomcat-embed-core-9.0.56.jar!/:na]
2022-06-11T11:00:30.210542+00:00 app[web.1]: at org.apache.tomcat.util.net.Acceptor.run(Acceptor.java:129) ~[tomcat-embed-core-9.0.56.jar!/:na]
2022-06-11T11:00:30.210542+00:00 app[web.1]: at java.lang.Thread.run(Thread.java:750) [na:1.8.0_332-heroku]
This is fixed recently according to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1924298
How can I report this issue to Heroku technical team to update their Linux to latest?

Getting error "Input string is too long for MQI field" while connecting to IBMMQ

I am connecting to IBMMQ which has ssl. I am able to connect to this IBM MQ using Java code and using MQ explorer. Now trying to connect using Node . I followed code given here by replacing all required values with the one which I got and then when i execute I get error
D:\IBMMQ\node_modules\ibmmq\lib\mqiutils.js:46
throw new RangeError(errstring);
^
RangeError: Input string is too long for MQI field
at Object.exports.setMQIString (D:\\IBMMQ\node_modules\ibmmq\lib\mqiutils.js:46:13)
at Object.exports._copyCDtoC (D:\\IBMMQ\node_modules\ibmmq\lib\mqcd.js:329:5)
at Object.exports._copyCNOtoC (D:\\IBMMQ\node_modules\ibmmq\lib\mqcno.js:131:21)
at connx (D:\\IBMMQ\node_modules\ibmmq\lib\mqi.js:754:21)
at Object.exports.Connx (D:\\IBMMQ\node_modules\ibmmq\lib\mqi.js:727:3)
at Object.<anonymous> (D:\IBMMQ\TestMQOMS.js:45:4)
at Module._compile (internal/modules/cjs/loader.js:1133:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
at Module.load (internal/modules/cjs/loader.js:977:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14)
Since it might be string length issue I tried updating my cipher value to just "xyz" but then i see error
MQ call failed in CONNX: MQCC = MQCC_FAILED [2] MQRC = MQRC_KEY_REPOSITORY_ERROR [2381]
Any idea how i can fix 'RangeError:' .
As suggested by Mark Taylor , i used less size cipher in matching cipher list. Code worked.

Requirejs with nodejs doesn't tell me the line number of the error, just the error

Requirejs with nodejs doesn't tell me the line number of the error, just the error
For example the result is: Error: Evaluating ccc.js as module "ccc" failed with error: SyntaxError: Unexpected token ,
And then the stack:
at Function.req.load (D:\web\pc\node_modules\requirejs\bin\r.js:2470:23)
at Object.context.load (D:\web\pc\node_modules\requirejs\bin\r.js:1858:21)
at Object.Module.load (D:\web\pc\node_modules\requirejs\bin\r.js:1059:29)
at Object.Module.fetch (D:\web\pc\node_modules\requirejs\bin\r.js:1049:66)
at Object.Module.check (D:\web\pc\node_modules\requirejs\bin\r.js:1079:26)
at Object.Module.enable (D:\web\pc\node_modules\requirejs\bin\r.js:1376:22)
at Object.context.enable (D:\web\pc\node_modules\requirejs\bin\r.js:1730:39)
at Object.<anonymous> (D:\web\pc\node_modules\requirejs\bin\r.js:1361:33)
at g (D:\web\pc\node_modules\requirejs\bin\r.js:363:23)
at each (D:\web\pc\node_modules\requirejs\bin\r.js:291:31)
at Object.Module.enable (D:\web\pc\node_modules\requirejs\bin\r.js:1323:17)
at Object.Module.init (D:\web\pc\node_modules\requirejs\bin\r.js:1013:26)
at callGetModule (D:\web\pc\node_modules\requirejs\bin\r.js:1403:63)
at Object.context.completeLoad (D:\web\pc\node_modules\requirejs\bin\r.js:1763:21)
at Function.req.load (D:\web\pc\node_modules\requirejs\bin\r.js:2510:17)
at Object.context.load (D:\web\pc\node_modules\requirejs\bin\r.js:1858:21)
at Object.Module.load (D:\web\pc\node_modules\requirejs\bin\r.js:1059:29)
at Object.Module.fetch (D:\web\pc\node_modules\requirejs\bin\r.js:1049:66)
at Object.Module.check (D:\web\pc\node_modules\requirejs\bin\r.js:1079:26)
at Object.Module.enable (D:\web\pc\node_modules\requirejs\bin\r.js:1376:22)
at Object.context.enable (D:\web\pc\node_modules\requirejs\bin\r.js:1730:39)
at Object.<anonymous> (D:\web\pc\node_modules\requirejs\bin\r.js:1361:33)
at g (D:\web\pc\node_modules\requirejs\bin\r.js:363:23)
at each (D:\web\pc\node_modules\requirejs\bin\r.js:291:31)
at Object.Module.enable (D:\web\pc\node_modules\requirejs\bin\r.js:1323:17)
at Object.Module.init (D:\web\pc\node_modules\requirejs\bin\r.js:1013:26)
at Object.context.makeRequire.mixin.isBrowser [as _onTimeout] (D:\web\pc\node_modules\requirejs\bin\r.js:1646:36)
at Timer.list.ontimeout (timers.js:101:19)
And where the error is? I know the file but what line?
thanks for help
It's not a problem with requirejs and was fixed in nodejs version 0.12.
Unfortunately, there are not enough hooks into vm.runInThisContext in
older node versions to get to the information.
More info you can find here
So, nodejs v.0.10 doesn't want to show additional info about problem. But if you want - you can install newest version of nodejs and gets more info about syntax errors in "required" files.
By the way, with Docker it's pretty easy - all you need just pull repo from node:0.12.

Nohm can't find Redis client

I'm trying to follow Tomas Davis's tutorial on Backbone.js but I can't make the server run.
He gives a standard node.js server with CORS enabled and a Redis database. Here's the link to his GitHub :
--> https://github.com/thomasdavis/video-backbone-beginner-server
There was one further problem that I solved, so you'll have to replace :
nohm.setClient(redis);
by :
redis.on("connect", function() {
nohm.setClient(redis);
console.log("Nohm Connected to Redis Client");
})
After that fix, Nohm seems to connect to Redis but still doesn't work. Here's the stack-trace :
{ name: 'Nohm Error',
message: 'Did not find a viable redis client in Nohm or the model: User' }
/node-projects/backbone/node_modules/nohm/lib/properties.js:27
if (!this.properties[key]) {
^
TypeError: Cannot read property 'firstname' of undefined
at Nohm.property (/node-projects/backbone/node_modules/nohm/lib/properties.js:27:23)
at Nohm.property (/node-projects/backbone/node_modules/nohm/lib/properties.js:22:23)
at Object.<anonymous> (/node-projects/backbone/example_server.js:110:6)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
The Redis server process is up though.
Does anyone know how to make the server work ?
Thank you in advance !
Sorry for the late reply, hope it'll still be of some help.
I cannot be 100% sure what the problem here is without knowing what /node-projects/backbone/example_server.js:110 is.
But my best guess is that while you wait for the connection you are trying to do other actions with nohm. Nohm then tries to access the client before the client is set.
This causes the init function of a model to fail, thus not properly initializing the internal variables (amongst others properties).
You need to wait with all model interaction until the redis connection is established. Or you revert to the old method of:
nohm.setClient(redis);
This should then queue up the redis commands until the connection is established, if I'm not mistaken.

Node.js redis "unknown command 'hset'"?

I'm new to redis, and I'm trying out various examples. However, it doesn't seem to work:
root#localhost:~# node lol.js
Reply: OK
Error: Error: Error: ERR unknown command 'hset'
Error: Error: Error: ERR unknown command 'hset'
/root/node_modules/redis/index.js:468
throw callback_err;
^
TypeError: Cannot read property 'length' of undefined
at Command.callback (/root/lol.js:15:28)
at RedisClient.return_error (/root/node_modules/redis/index.js:464:25)
at HiredisReplyParser.<anonymous> (/root/node_modules/redis/index.js:253:14)
at HiredisReplyParser.emit (events.js:67:17)
at HiredisReplyParser.execute (/root/node_modules/redis/lib/parser/hiredis.js:41:18)
at RedisClient.on_data (/root/node_modules/redis/index.js:440:27)
at Socket.<anonymous> (/root/node_modules/redis/index.js:70:14)
at Socket.emit (events.js:67:17)
at TCP.onread (net.js:367:14)
I'm using one of the example scripts on the github page for node-redis. I'm on Debian Squeeze.
The main problem is not with your code (of course it could recognize the error sent by the server) or with the node redis module but with the Redis server.
You need to upgrade it to a newer version, HSET command is supported since version 2.0.0.

Resources