synchrony / smsn-mode

Emacs client for Semantic Synchrony knowledge graphs
GNU General Public License v3.0
11 stars 6 forks source link

[1.5] Error (websocket): in callback `on-message': Wrong type argument: char-or-string-p, ((mapType . "java.util.HashMap") (empty . :json-false)) #29

Closed jmatsushita closed 1 year ago

jmatsushita commented 1 year ago

Hi there,

Got here following breadcrumbs from a categorical databases rdf haskell search, which popped up hydra which I hadn't seen before in the haskell ecosystem and got me (back) here, very curious and excited about what a personal knowledge base with the potential to be connected to hydra. Both on how it's structured and it's contents!

I've deployed the develop branch (gradle 6 built, on jdk 11) version of smsn-server and the main branch of smsn-mode and I bump into this error when trying to switch to smsn-mode with M-x smsn:

Error (websocket): in callback `on-message': Wrong type argument: char-or-string-p, ((mapType . "java.util.HashMap") (empty . :json-false))

Here are the server logs at DEBUG level

I wasn't yet able to get to the point of importing new data, so maybe the error comes from the fact that the graph is empty? (the queries from this wiki page didn't return anything). I did clone both the data-universal and data-public repos in data/sources/universal and data/sources/public but I suppose I'm missing an import step which I believe can be done with smsn-read-vcs but since I can't start smsn-mode I'm stuck.

Cheers,

Jun

jmatsushita commented 1 year ago

I tried M-x smsn-read-vcs and the server logs imported VCS data in 1 ms (before commit). Resulting graph has 0 notes but replies with the same "empty": false which seems to throw off smsn-mode.

         +-------------------------------------------------+
         |  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f |
+--------+-------------------------------------------------+----------------+
|00000000| 7b 22 6f 70 22 3a 22 65 76 61 6c 22 2c 22 70 72 |{"op":"eval","pr|
|00000010| 6f 63 65 73 73 6f 72 22 3a 22 73 65 73 73 69 6f |ocessor":"sessio|
|00000020| 6e 22 2c 22 61 72 67 73 22 3a 7b 22 6c 61 6e 67 |n","args":{"lang|
|00000030| 75 61 67 65 22 3a 22 73 6d 73 6e 22 2c 22 73 65 |uage":"smsn","se|
|00000040| 73 73 69 6f 6e 22 3a 22 75 6e 64 65 66 69 6e 65 |ssion":"undefine|
|00000050| 64 22 2c 22 67 72 65 6d 6c 69 6e 22 3a 22 7b 5c |d","gremlin":"{\|
|00000060| 22 61 63 74 69 6f 6e 5c 22 3a 5c 22 6e 65 74 2e |"action\":\"net.|
|00000070| 66 6f 72 74 79 74 77 6f 2e 73 6d 73 6e 2e 73 65 |fortytwo.smsn.se|
|00000080| 72 76 65 72 2e 61 63 74 69 6f 6e 73 2e 52 65 61 |rver.actions.Rea|
|00000090| 64 47 72 61 70 68 5c 22 2c 5c 22 66 6f 72 6d 61 |dGraph\",\"forma|
|000000a0| 74 5c 22 3a 5c 22 56 43 53 5c 22 7d 22 7d 7d    |t\":\"VCS\"}"}} |
+--------+-------------------------------------------------+----------------+
[DEBUG] Slf4JLogger - [id: 0x881a458c, L:/100.70.7.21:8182 - R:/100.101.232.83:51280] RECEIVED: RequestMessage{, requestId=null, op='eval', processor='session', args={language=smsn, session=undefined, gremlin={"action":"net.fortytwo.smsn.server.actions.ReadGraph","format":"VCS"}}}
[DEBUG] AbstractEvalOpProcessor - Selecting processor for RequestMessage RequestMessage{, requestId=null, op='eval', processor='session', args={language=smsn, session=undefined, gremlin={"action":"net.fortytwo.smsn.server.actions.ReadGraph","format":"VCS"}}}
[DEBUG] SessionOpProcessor - In-session request null for eval for session undefined in thread gremlin-server-worker-1
[DEBUG] GremlinExecutor - Preparing to evaluate script - {"action":"net.fortytwo.smsn.server.actions.ReadGraph","format":"VCS"} - in thread [gremlin-server-worker-1]
[DEBUG] GremlinExecutor - Schedule timeout for script - {"action":"net.fortytwo.smsn.server.actions.ReadGraph","format":"VCS"} - in thread [gremlin-server-session-1]
[DEBUG] GremlinExecutor - Evaluating script - {"action":"net.fortytwo.smsn.server.actions.ReadGraph","format":"VCS"} - in thread [gremlin-server-session-1]
INFO: Mon Jul 10 10:55:19 CEST 2023: net.fortytwo.smsn.brain.io.Format initializeReaders: loaded 4 readers
WARNING: Mon Jul 10 10:55:19 CEST 2023: net.fortytwo.smsn.brain.io.Format initializeWriters: writer has no formats: net.fortytwo.smsn.brain.io.rdf.RDFWriter@1a6cdbff
INFO: Mon Jul 10 10:55:19 CEST 2023: net.fortytwo.smsn.brain.io.Format initializeWriters: loaded 8 writers
INFO: Mon Jul 10 10:55:19 CEST 2023: net.fortytwo.smsn.brain.io.NoteReader doImport: imported VCS data in 1 ms (before commit). Resulting graph has 0 notes
INFO: Mon Jul 10 10:55:19 CEST 2023: net.fortytwo.smsn.server.Action handleRequest: completed ReadGraph action in 27 ms
[DEBUG] AbstractEvalOpProcessor - Preparing to iterate results from - RequestMessage{, requestId=null, op='eval', processor='session', args={language=smsn, session=undefined, gremlin={"action":"net.fortytwo.smsn.server.actions.ReadGraph","format":"VCS"}}} - in thread [gremlin-server-session-1]
[DEBUG] Slf4JLogger - [id: 0x881a458c, L:/100.70.7.21:8182 - R:/100.101.232.83:51280] WRITE: org.apache.tinkerpop.gremlin.server.handler.Frame@4157d830
[DEBUG] Slf4JLogger - [id: 0x881a458c, L:/100.70.7.21:8182 - R:/100.101.232.83:51280] WRITE: TextWebSocketFrame(data: UnpooledUnsafeHeapByteBuf(ridx: 0, widx: 145, cap: 435)), 145B
         +-------------------------------------------------+
         |  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f |
+--------+-------------------------------------------------+----------------+
|00000000| 7b 22 72 65 71 75 65 73 74 49 64 22 3a 6e 75 6c |{"requestId":nul|
|00000010| 6c 2c 22 73 74 61 74 75 73 22 3a 7b 22 6d 65 73 |l,"status":{"mes|
|00000020| 73 61 67 65 22 3a 22 22 2c 22 63 6f 64 65 22 3a |sage":"","code":|
|00000030| 32 30 30 2c 22 61 74 74 72 69 62 75 74 65 73 22 |200,"attributes"|
|00000040| 3a 7b 7d 7d 2c 22 72 65 73 75 6c 74 22 3a 7b 22 |:{}},"result":{"|
|00000050| 64 61 74 61 22 3a 5b 7b 22 6d 61 70 54 79 70 65 |data":[{"mapType|
|00000060| 22 3a 22 6a 61 76 61 2e 75 74 69 6c 2e 48 61 73 |":"java.util.Has|
|00000070| 68 4d 61 70 22 2c 22 65 6d 70 74 79 22 3a 66 61 |hMap","empty":fa|
|00000080| 6c 73 65 7d 5d 2c 22 6d 65 74 61 22 3a 7b 7d 7d |lse}],"meta":{}}|
|00000090| 7d                                              |}               |
+--------+-------------------------------------------------+----------------+
[DEBUG] Slf4JLogger - Encoding WebSocket Frame opCode=1 length=145
[DEBUG] Slf4JLogger - [id: 0x881a458c, L:/100.70.7.21:8182 - R:/100.101.232.83:51280] WRITE: 149B
jmatsushita commented 1 year ago

Oh, just realised my sources config doesn't point to the correct folders:

sources:
  -
    location: ../smsn-data/vcs/private
    name: private
    code: a
    color: 0xff0000
  -
    location: ../smsn-data/vcs/personal
    name: personal
    code: s
    color: 0xffc000
  -
    location: ../smsn-data/vcs/public
    name: public
    code: d
    color: 0x00e000
  -
    location: ../smsn-data/vcs/universal
    name: universal
    code: f
    color: 0x0000ff
jmatsushita commented 1 year ago

Progress!

INFO: Mon Jul 10 11:13:52 CEST 2023: net.fortytwo.smsn.brain.io.NoteReader doImport: imported VCS data in 93864 ms (before commit). Resulting graph has 106042 notes
INFO: Mon Jul 10 11:13:53 CEST 2023: net.fortytwo.smsn.server.Action handleRequest: completed ReadGraph action in 94544 ms

So the graph being empty was not the cause of the error.

jmatsushita commented 1 year ago

Looks indeed like the import succeeded

gremlin> g.V().limit(10).values()
==>Geneva Diagnostics
==>gd
==>1315268895035
==>public
==>YaNoKSy9RqnQc7Bt
==>

It looks like it's the getConfiguration action that yields unexpected results.

jmatsushita commented 1 year ago

Could be related to https://github.com/synchrony/smsn/issues/52 as I'm seeing the same warning

[WARN] GremlinExecutor - Initialization script conf/smsn.yaml did not return a Map - no global bindings specified
[INFO] GremlinExecutor - Initialized smsn ScriptEngine with conf/smsn.yaml
jmatsushita commented 1 year ago

Hmm, it seems indeed that the conf/smsn.yaml I specified in conf/gremlin-server-smsn.yaml is not picked up https://gist.github.com/jmatsushita/3212b8d5a3c332f009cd405089c90840#file-smsn-server-log-L46

So the smsn-default.yaml is used instead. (and indeed if I delete the data/sources folder (my smsn.yaml points instead to data/vcs) when I restart gremlin-server I see this folder being recreated.

It's strange though, since the import worked and clearly was using my smsn.yaml file to find the data/vcs folders....

If I lean into this and remove my smsn.yaml file and move the cloned public and universal I see this warning (since my gremlin-server-smsn.yaml still points to conf/smsn.yaml:

[WARN] GremlinExecutor - Could not initialize smsn ScriptEngine with /home/jun/dev/smsn/smsn/deploy/apache-tinkerpop-gremlin-server-3.2.5/conf/smsn.yaml as file does not exist

But other than that the M-x smsn-read-vcs works and overall nothing changed. So I suspect there's something strange going on with configuration loading, but it's not the root cause for the error I'm seeing.

jmatsushita commented 1 year ago

I added log statements in smsn-core and it seems that the configuration is empty indeed.

    public static void readConfigurationYaml(final InputStream input) {
        configuration = new Yaml().loadAs(input, Configuration.class);
        logger.log(Level.INFO, "readConfigurationYaml", configuration);
    }

    public static Configuration getConfiguration() {
        logger.log(Level.INFO, "getConfiguration", configuration);
        return configuration;
    }

I'm seeing these logs on startup

[DEBUG] AbstractFileConfiguration - FileName set to neo4j.properties
[DEBUG] AbstractFileConfiguration - Base path set to /home/jun/dev/smsn/smsn/deploy/apache-tinkerpop-gremlin-server-3.2.5/conf
[DEBUG] ConfigurationUtils - ConfigurationUtils.locate(): base is /home/jun/dev/smsn/smsn/deploy/apache-tinkerpop-gremlin-server-3.2.5/conf, name is neo4j.properties
[DEBUG] DefaultFileSystem - Could not locate file neo4j.properties at /home/jun/dev/smsn/smsn/deploy/apache-tinkerpop-gremlin-server-3.2.5/conf: no protocol: /home/jun/dev/smsn/smsn/deploy/apache-tinkerpop-gremlin-server-3.2.5/conf
[DEBUG] ConfigurationUtils - Loading configuration from the path /home/jun/dev/smsn/smsn/deploy/apache-tinkerpop-gremlin-server-3.2.5/conf/neo4j.properties
[INFO] DefaultGraphManager - Graph [graph] was successfully configured via [conf/neo4j.properties].
[INFO] ServerGremlinExecutor - Initialized Gremlin thread pool.  Threads in pool named with pattern gremlin-*
[INFO] ScriptEngines - Loaded smsn ScriptEngine
[INFO] ScriptEngines - Loaded gremlin-groovy ScriptEngine
INFO: Mon Jul 10 13:14:40 CEST 2023: net.fortytwo.smsn.SemanticSynchrony loadYamlFromDefaultLocation: using default Semantic Synchrony configuration
INFO: Mon Jul 10 13:14:40 CEST 2023: net.fortytwo.smsn.SemanticSynchrony readConfigurationYaml: readConfigurationYaml
INFO: Mon Jul 10 13:14:40 CEST 2023: net.fortytwo.smsn.SemanticSynchrony readConfigurationYaml: readConfigurationYaml
INFO: Mon Jul 10 13:14:40 CEST 2023: net.fortytwo.smsn.server.SmSnScriptEngine readAsYaml: added configuration
INFO: Mon Jul 10 13:14:40 CEST 2023: net.fortytwo.smsn.server.Action getBrain: instantiating Extend-o-Brain with base graph neo4jgraph[Community [/home/jun/dev/smsn/smsn/deploy/apache-tinkerpop-gremlin-server-3.2.5/data/smsn-neo4j]]
INFO: Mon Jul 10 13:14:40 CEST 2023: net.fortytwo.smsn.SemanticSynchrony getConfiguration: getConfiguration
INFO: Mon Jul 10 13:14:40 CEST 2023: net.fortytwo.smsn.SemanticSynchrony getConfiguration: getConfiguration
INFO: Mon Jul 10 13:14:40 CEST 2023: net.fortytwo.smsn.server.Action handleRequest: completed NoAction action in 1 ms

And when making the M-x smsn request:

[DEBUG] GremlinExecutor - Evaluating script - {"action":"net.fortytwo.smsn.server.actions.GetConfiguration","filter":{"minSource":null,"defaultSource":null,"minWeight":0.0,"defaultWeight":0.5}} - in thread [gremlin-server-session-1]
INFO: Mon Jul 10 13:15:18 CEST 2023: net.fortytwo.smsn.SemanticSynchrony getConfiguration: getConfiguration
INFO: Mon Jul 10 13:15:18 CEST 2023: net.fortytwo.smsn.server.Action handleRequest: completed GetConfiguration action in 35 ms
jmatsushita commented 1 year ago

Oh I see,if I add:

    private static void loadYamlFromDefaultLocation() throws IOException {
        File f = new File(SMSN_YAML);
        logger.info("getAbsolutePath" + f.getAbsolutePath());

I see there's some confusion about the base path:

[DEBUG] AbstractFileConfiguration - Base path set to /home/jun/dev/smsn/smsn/deploy/apache-tinkerpop-gremlin-server-3.2.5/conf
(...)
INFO: Mon Jul 10 13:23:44 CEST 2023: net.fortytwo.smsn.SemanticSynchrony loadYamlFromDefaultLocation: getAbsolutePath/home/jun/dev/smsn/smsn/deploy/apache-tinkerpop-gremlin-server-3.2.5/smsn.yaml
INFO: Mon Jul 10 13:23:44 CEST 2023: net.fortytwo.smsn.SemanticSynchrony loadYamlFromDefaultLocation: using default Semantic Synchrony configuration
INFO: Mon Jul 10 13:23:44 CEST 2023: net.fortytwo.smsn.SemanticSynchrony readConfigurationYaml: input
INFO: Mon Jul 10 13:23:44 CEST 2023: net.fortytwo.smsn.SemanticSynchrony readConfigurationYaml: configuration
INFO: Mon Jul 10 13:23:44 CEST 2023: net.fortytwo.smsn.SemanticSynchrony readConfigurationYaml: input
INFO: Mon Jul 10 13:23:44 CEST 2023: net.fortytwo.smsn.SemanticSynchrony readConfigurationYaml: configuration

Also seems that SMSN_YAML is hardcoded. I'll try with:

    private static final String
-            SMSN_YAML = "smsn.yaml",
+            SMSN_YAML = "conf/smsn.yaml",
            SMSN_DEFAULT_YAML = "smsn-default.yaml";

Indeed this does address the use of the smsn-default.yaml file on startup.

Also realising my java.util.logging-fu is not there 😓 this logger.log(Level.INFO, "configuration {0}", configuration.getSources());; works better of course and show that the configuration seems to be loaded (although twice apparently):

INFO: Mon Jul 10 13:53:28 CEST 2023: net.fortytwo.smsn.SemanticSynchrony loadYamlFromDefaultLocation: getAbsolutePath/home/jun/dev/smsn/smsn/deploy/apache-tinkerpop-gremlin-server-3.2.5/conf/smsn.yaml
INFO: Mon Jul 10 13:53:28 CEST 2023: net.fortytwo.smsn.SemanticSynchrony loadYamlFromDefaultLocation: loading Semantic Synchrony configuration at /home/jun/dev/smsn/smsn/deploy/apache-tinkerpop-gremlin-server-3.2.5/conf/smsn.yaml
INFO: Mon Jul 10 13:53:28 CEST 2023: net.fortytwo.smsn.SemanticSynchrony readConfigurationYaml: input java.io.FileInputStream@48477e00
INFO: Mon Jul 10 13:53:28 CEST 2023: net.fortytwo.smsn.SemanticSynchrony readConfigurationYaml: configuration [net.fortytwo.smsn.config.DataSource@6925ab02, net.fortytwo.smsn.config.DataSource@3a2a2251, net.fortytwo.smsn.config.DataSource@6b13fdb4, net.fortytwo.smsn.config.DataSource@5b011e63]
INFO: Mon Jul 10 13:53:28 CEST 2023: net.fortytwo.smsn.SemanticSynchrony readConfigurationYaml: input java.io.StringBufferInputStream@1fb8d3ba
INFO: Mon Jul 10 13:53:28 CEST 2023: net.fortytwo.smsn.SemanticSynchrony readConfigurationYaml: configuration [net.fortytwo.smsn.config.DataSource@49cac30c, net.fortytwo.smsn.config.DataSource@6cdae0ad, net.fortytwo.smsn.config.DataSource@406d538c, net.fortytwo.smsn.config.DataSource@3cb359a]
INFO: Mon Jul 10 13:53:28 CEST 2023: net.fortytwo.smsn.server.SmSnScriptEngine readAsYaml: added configuration
INFO: Mon Jul 10 13:53:28 CEST 2023: net.fortytwo.smsn.server.Action getBrain: instantiating Extend-o-Brain with base graph neo4jgraph[Community [/home/jun/dev/smsn/smsn/deploy/apache-tinkerpop-gremlin-server-3.2.5/data/smsn-neo4j]]
INFO: Mon Jul 10 13:53:28 CEST 2023: net.fortytwo.smsn.SemanticSynchrony getConfiguration: configuration [net.fortytwo.smsn.config.DataSource@49cac30c, net.fortytwo.smsn.config.DataSource@6cdae0ad, net.fortytwo.smsn.config.DataSource@406d538c, net.fortytwo.smsn.config.DataSource@3cb359a]
INFO: Mon Jul 10 13:53:28 CEST 2023: net.fortytwo.smsn.SemanticSynchrony getConfiguration: configuration [net.fortytwo.smsn.config.DataSource@49cac30c, net.fortytwo.smsn.config.DataSource@6cdae0ad, net.fortytwo.smsn.config.DataSource@406d538c, net.fortytwo.smsn.config.DataSource@3cb359a]

So now I'm looking at these logs again and wondering if there's something about the standalone smsn-server jar loading configuration fine, but that the scripting engine doesn't...?

[WARN] GremlinExecutor - Initialization script conf/smsn.yaml did not return a Map - no global bindings specified
[INFO] GremlinExecutor - Initialized smsn ScriptEngine with conf/smsn.yaml
jmatsushita commented 1 year ago

Progress!

Adding logging here

    private JSONObject toJson(final Map<String, Object> map) {
        logger.log(Level.INFO, "map {0}", map);
        return new JSONObject(map);
    }

Turns up what seems to be a correct response payload:

INFO: Mon Jul 10 14:14:29 CEST 2023: net.fortytwo.smsn.server.SmSnScriptEngine toJson: map {configuration={"version":"1.5","activityLog":"data/activity.log","transactionBufferSize":100,"thingNamespace":"http://example.org/things/","brainstream":null,"verbose":false,"services":{"agentIri":null,"broadcast":{"host":"255.255.255.255","port":42000,"graph":null,"interval":5000},"osc":{"host":null,"port":42002,"graph":null,"interval":0},"pubSub":{"host":null,"port":42001,"graph":null,"interval":0},"server":null,"music":null},"sources":[{"name":"private","code":"a","location":"data/sources/private","color":16711680},{"name":"personal","code":"s","location":"data/sources/personal","color":16760832},{"name":"public","code":"d","location":"data/sources/public","color":57344},{"name":"universal","code":"f","location":"data/sources/universal","color":255}]}, title=[no title]}

So the problem must be downstream of this in the response path...

jmatsushita commented 1 year ago

This seems promising https://stackoverflow.com/questions/76097805/jsonobject-inside-an-object-is-getting-serialized-to-some-other-form-as-compared as it produces the same result:

Result produces : {"name":"name", {"empty":false,"mapType":"java.util.HashMap"}}

Expected result : {"name":"name", "json": {"key":"value"}}

There is a writeValueAsString call in GetConfiguration but logging it's results shows that's serialising correctly.

That leaves me thinking it's the SessionOpProcessor trying to serialize upstream. I tried to comment out all serializers from the gremlin config, but still no dice.

[DEBUG] AbstractEvalOpProcessor - Preparing to iterate results from - RequestMessage{, requestId=null, op='eval', processor='session', args={language=smsn, session=undefined, gremlin={"action":"net.fortytwo.smsn.server.actions.GetConfiguration","filter":{"minSource":null,"defaultSource":null,"minWeight":0.0,"defaultWeight":0.5}}}} - in thread [gremlin-server-session-1]

I tried to run another command from smsn-mode M-x smsn-events to see if other things work and got a stack trace which makes me think using the 1.5 develop branch is probably too ambitious.

org.apache.tinkerpop.shaded.jackson.databind.exc.InvalidTypeIdException: Could not resolve type id 'net.fortytwo.smsn.server.actions.GetEvents' into a subtype of [simple type, class net.fortytwo.smsn.server.Action]: no such class found
 at [Source: {"action":"net.fortytwo.smsn.server.actions.GetEvents","filter":{"minSource":null,"defaultSource":null,"minWeight":0.0,"defaultWeight":0.5},"titleCutoff":100,"style":"forward"}; line: 1, column: 11]
        at org.apache.tinkerpop.shaded.jackson.databind.exc.InvalidTypeIdException.from(InvalidTypeIdException.java:42)
        at org.apache.tinkerpop.shaded.jackson.databind.DeserializationContext.unknownTypeIdException(DeserializationContext.java:1477)
        at org.apache.tinkerpop.shaded.jackson.databind.DeserializationContext.handleUnknownTypeId(DeserializationContext.java:1170)
        at org.apache.tinkerpop.shaded.jackson.databind.jsontype.impl.ClassNameIdResolver._typeFromId(ClassNameIdResolver.java:65)
        at org.apache.tinkerpop.shaded.jackson.databind.jsontype.impl.ClassNameIdResolver.typeFromId(ClassNameIdResolver.java:42)
        at org.apache.tinkerpop.shaded.jackson.databind.jsontype.impl.TypeDeserializerBase._findDeserializer(TypeDeserializerBase.java:150)
        at org.apache.tinkerpop.shaded.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer._deserializeTypedForId(AsPropertyTypeDeserializer.java:112)
        at org.apache.tinkerpop.shaded.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer.deserializeTypedFromObject(AsPropertyTypeDeserializer.java:97)
        at org.apache.tinkerpop.shaded.jackson.databind.deser.AbstractDeserializer.deserializeWithType(AbstractDeserializer.java:142)
        at org.apache.tinkerpop.shaded.jackson.databind.deser.impl.TypeWrappedDeserializer.deserialize(TypeWrappedDeserializer.java:63)
        at org.apache.tinkerpop.shaded.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3798)
        at org.apache.tinkerpop.shaded.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2842)
        at net.fortytwo.smsn.server.SmSnScriptEngine.readAsJson(SmSnScriptEngine.java:62)
        at net.fortytwo.smsn.server.SmSnScriptEngine.deserializeRequest(SmSnScriptEngine.java:135)
        at net.fortytwo.smsn.server.SmSnScriptEngine.handleRequest(SmSnScriptEngine.java:121)
        at net.fortytwo.smsn.server.SmSnScriptEngine.eval(SmSnScriptEngine.java:43)
        at java.scripting/javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:233)
        at org.apache.tinkerpop.gremlin.groovy.engine.ScriptEngines.eval(ScriptEngines.java:120)
        at org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor.lambda$eval$2(GremlinExecutor.java:314)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)

I'll try and checkout 1.4 and 1.3 tags.

jmatsushita commented 1 year ago

Had similar issue with the location of the smsn.yaml file with 1.4 but M-x smsn worked (returning the correctly serialized payload), but M-x smsn-read-vcs didn't work, so I ended up copying the smsn-neo4j folder from the 1.5 version and it worked 🥳 . I can now switch to smsn-mode and I've tried search so far which seems to work.

         +-------------------------------------------------+
         |  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f |
+--------+-------------------------------------------------+----------------+
|00000000| 81 7e 00 80 7b 22 72 65 71 75 65 73 74 49 64 22 |.~..{"requestId"|
|00000010| 3a 6e 75 6c 6c 2c 22 73 74 61 74 75 73 22 3a 7b |:null,"status":{|
|00000020| 22 6d 65 73 73 61 67 65 22 3a 22 22 2c 22 63 6f |"message":"","co|
|00000030| 64 65 22 3a 32 30 30 2c 22 61 74 74 72 69 62 75 |de":200,"attribu|
|00000040| 74 65 73 22 3a 7b 7d 7d 2c 22 72 65 73 75 6c 74 |tes":{}},"result|
|00000050| 22 3a 7b 22 64 61 74 61 22 3a 5b 22 7b 5c 22 74 |":{"data":["{\"t|
|00000060| 69 74 6c 65 5c 22 3a 5c 22 5b 6e 6f 20 74 69 74 |itle\":\"[no tit|
|00000070| 6c 65 5d 5c 22 7d 22 5d 2c 22 6d 65 74 61 22 3a |le]\"}"],"meta":|
|00000080| 7b 7d 7d 7d                                     |{}}}            |
+--------+-------------------------------------------------+----------------+

Unfortunately C-c n fails with request failed: no such root: create-new-note and the following in the server logs:

java.lang.IllegalArgumentException: no such root: create-new-note
        at net.fortytwo.smsn.server.actions.FilteredAction.getRoot(FilteredAction.java:35)
        at net.fortytwo.smsn.server.actions.RootedViewAction.performTransaction(RootedViewAction.java:33)
        at net.fortytwo.smsn.server.actions.GetView.performTransaction(GetView.java:18)
        at net.fortytwo.smsn.server.Action.lambda$wrapTransactionAndExceptions$0(Action.java:135)
        at net.fortytwo.smsn.brain.model.TopicGraph.wrapInTransaction(TopicGraph.java:84)
        at net.fortytwo.smsn.server.Action.wrapTransactionAndExceptions(Action.java:135)
        at net.fortytwo.smsn.server.Action.handleRequest(Action.java:94)
        at net.fortytwo.smsn.server.SmSnScriptEngine$ActionPerformer.perform(SmSnScriptEngine.java:159)
        at net.fortytwo.smsn.server.SmSnScriptEngine.handleRequest(SmSnScriptEngine.java:122)
        at net.fortytwo.smsn.server.SmSnScriptEngine.eval(SmSnScriptEngine.java:42)
        at java.scripting/javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:233)
        at org.apache.tinkerpop.gremlin.groovy.engine.ScriptEngines.eval(ScriptEngines.java:120)
        at org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor.lambda$eval$2(GremlinExecutor.java:314)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)

This seems to indicate some API mismatch between smsn-mode and smsn-server as I wouldn't expect to see create-new-note as a rootId.

I'll try 1.3 and will probably let it rest for today...

jmatsushita commented 1 year ago

Oh I should have also reverted smsn-mode to 1.4 I was able to create a note! 🥳

image
joshsh commented 1 year ago

Hi @jmatsushita. These are heroic efforts! It shouldn't be this hard, and 1.5 should definitely work -- but I can't tell exactly what is wrong, even with all of the information you provided. It has been a long time since I have had to think about configuration/setup, so the issues you are running into are not fresh in my mind. A video call might be a shortcut to success -- maybe tomorrow or Wednesday morning Pacific time, as I see you are in Europe. Please feel free to email me at: josh at fortytwo dot net. I appreciate the enthusiasm! The future of SmSn is definitely intertwined with Hydra and the LambdaGraph model. The Hydra Discord server (https://discord.gg/wbsbGe7j ) might be a good place to discuss that.

jmatsushita commented 1 year ago

Hi @joshsh, thanks a ton for you reply :)

It shouldn't be this hard, and 1.5 should definitely work

Since I was seeing commits in data-universal I guessed that things should be working.

It has been a long time since I have had to think about configuration/setup, so the issues you are running into are not fresh in my mind.

Completely understand! And a good reason to be interested in knowledge management and good tooling :) Context switching is so costly!

A video call might be a shortcut to success

I really appreciate that and just sent you an email and joined the Discord 🙏

jmatsushita commented 1 year ago

I found the culprit (a breaking change in org.json:json:20180813 ) which I suspect is throwing silently in some serializer and will submit a PR to smsn.