opencog / atomspace

The OpenCog (hyper-)graph database and graph rewriting system
https://wiki.opencog.org/w/AtomSpace
Other
795 stars 225 forks source link

In proxy agent example, cog server hangs when using proxy #3032

Closed sikefield3 closed 1 year ago

sikefield3 commented 1 year ago

I'm trying out the proxy agent example by using a docker compose file to start the cogserver + another container. When I get to this line: https://github.com/opencog/atomspace/blob/cffd9e20a2a08be16425fb4ed7d31333a65e8f3f/examples/atomspace/persist-proxy.scm#L117 , the guile prompt hangs (+5 min) There don't seem to be any issues with missing ports, since I checked them with tcpdump.
In the log file /tmp/cogserver.log , there is some exception:

Long C++ stack trace
...
[2023-02-08 08:59:28:614] [INFO] [GenericShell] evaluator error:
Expecting a list of ProxyNodes! Got
(ProxyParameters
  (WriteThruProxy "wthru mirror")
  (List
    (RocksStorage "rocks:///tmp/foo.rdb")
    (RocksStorage "rocks:///tmp/bar.rdb")))
 (/home/opcwdir/repodock/atomspace/opencog/persist/proxy/ProxyNode.cc:109)
linas commented 1 year ago

Offtopic, last night I cleaned up the opencog/docker git repo, and updated all containers to run Ubuntu 22.04 .. so just FYI. I updated the README too, and removed the old cruft.

linas commented 1 year ago

OK, here is what I think happened. On the cogserver side, the persist-rocks module was not loaded, either because you forgot or there was some other error that caused it not to load. As a result, the cast in line 107 fails.

I'm now setting up a more user-friendly error message. (The Proxy stuff is brand-new, its beta code. Glitches won't be surprising.) In the meanwhile you should double-check that persist-rocks is loaded.

And I think I see how that happened: you say:

by using a docker compose file to start the cogserver

and the cogserver container probably did not load the persist-rocks module. Just FYI, there are more than several dozen different modules, in various states of working or disrepair, and the cogserver does not attempt to load any of them. So you have to make sure you load the ones you want.

There are two ways to do this. One is to start /usr/bin/cogserver and telnet into it and then do the (use-modules (opencog foobar)) as needed. Yuck.

The better way is to set up a shell script: something like this (... next post, this post is too long)

linas commented 1 year ago

Here's an example cogserver shell script: https://github.com/opencog/docker/blob/master/opencog/atomspace/scripts/cogserver.scm

Copy that, edit as desired. Its a script, so if you chmod ugo+x on it, you can just say ./my-cogserver-starter.scm and the file magic of #! /usr/bin/env -S guile should just work.

Note BTW, how the cogserver is started: towards the end, it says #:web 0 This parameter says "do not start websockets". I've found that my web browser is attempting to connect to the websockets server every 10 seconds, and then closing the connection. I don't know if this is hostile or malware or some weird firefox bug or what, but I don't like it. The /tmp/cogserver.log file fills up with warnings. Since you're not using websockets, just turn it off.

sikefield3 commented 1 year ago

OK, here is what I think happened. On the cogserver side, the persist-rocks module was not loaded, either because you forgot or there was some other error that caused it not to load. As a result, the cast in line 107 fails.

Oops my bad !
For some reason, I wasn't able to start the container with the guile script, so I did it directly.

linas commented 1 year ago

If you are/were using the cogserver container from the opencog/docker git repo ... I just removed that yesterday. It is no more. If you want to keep doing this, use the atomspace container, I placed a copy of that cogserver.scm file so that is shows up in the home directory. That's the best way to start the thing.

sikefield3 commented 1 year ago

I'm going to try your script. Thanks!
So far, I was using my own docker/yaml files, to get more familiar with docker.

linas commented 1 year ago

I was using my own docker/yaml files, to get more familiar with docker.

That's a good idea. I've been using lxc, I like lxc.

I'm going to close this issue, seems like there's nothing left to do.