Comments (12)
wait, where's the bug? It sets the space to alt-as correct it looks like?
from cogserver.
oh, nevermind, cog-set-atomspace supposed to return the previous atomspace
from cogserver.
is this still a bug?
from cogserver.
Yes.
I also noticed the default atomspace and the new atomspace has different length, not sure if that's part of the problem.
guile> (define alt-as (cog-new-atomspace))
guile> (cog-set-atomspace! alt-as)
#<atomspace 0x2557f50>
guile> (cog-atomspace)
#<atomspace 0x2557f50>
guile> alt-as
#<atomspace 0x7f56140113c0>
guile>
from cogserver.
This bug only happens in the lower scm shell, at port 17001 not the one at 18001
from cogserver.
Yeah, I can reproduce this. It is a "feature" not a "bug".
By design, each thread can have a different current atomspace. This so that you can run two threads, each doing different work in different atomspaces. It works, and I believe one of the unit tests tests this.
The port-17001 shell processor works like this: it creates a new thread, evaluates the scheme in the new thread, and then ends that thread, returning any string output in the main command-prompt thread. You can verify this by issuing this on a single line: (cog-set-atomspace! alt-as) (ConceptNode "qwerty") (cog-prt-atomspace )
To avoid this confusion, we can change port 17001 to not fork a new thread for each command. This makes it sightly less convenient, though -- one then cannot send interrupts (ctrl-C) to kill the running process, if it hangs. Working with long-running scripts becomes hard too ...
from cogserver.
I'm strongly tempted to close this as "not a bug"; before closing, though, the docs for 17001 should be updated to explain this.
from cogserver.
ok, then basically the issue is how to handle multiple (nested or cloned) atomspaces in a single thread.
I guess if one want to use multiple atomspaces, then they can swith to port 18001
from cogserver.
By the way, what is the purpose of having two scheme shells?
from cogserver.
!? multiple nested/cloned atomspace work just fine in a single thread or in multiple threads.
If you want to use port 17001 in a single thread, then you have three choices:
- put your scheme code in a file, and then load that file. Everything will execute in the same thread.
- cut-n-paste your code into one line. The 17001 shell creates a new thread for each tcpip stream packet that has a carriage return at the end of it.
- alter the c++ code to not create a new thread when running 17001 commands. Very strongly discouraged.
from cogserver.
There are not two, but three scheme shells :-) all sharing the same atomspaces. so, for example:
$ guile
GNU Guile 2.0.9
Copyright (C) 1995-2013 Free Software Foundation, Inc.
Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.
Enter `,help' for help.
scheme@(guile-user)> (use-modules (opencog cogserver))
scheme@(guile-user)> (start-cogserver)
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;; or pass the --no-auto-compile argument to disable.
;;; compiling /usr/local/share/opencog/scm/repl-shell.scm
;;; compiled /home/linas/.cache/guile/ccache/2.0-LE-8-2.0/usr/local/share/opencog/scm/repl-shell.scm.go
Listening on port 17001
$6 = "Started CogServer"
The above shares the same atomspaces with both 17001 and 18001.
The 17001 was the earliest implementation.
The 18001 came later, when the guile guys added a simple tcpip server at some point. For me, 18001 has always been buggy, though, prone to hangs and weird behavior. Shame about that.
The third form, of just running the cogserver inside scheme, instead of the other way around, only became possible recently, when we hacked together all the infrastructure needed for guile modules.
from cogserver.
That is clear, thanks.
For interactive experimentation, 18001 or the third shell are enough.
I have changed the labeling to documentation. This should come in handy for the python shell(or future haskell shell maybe) too. As consistant behavior, were possible, will make opencog-noob's life easier.
from cogserver.
Related Issues (16)
- encounter missing install target HOT 5
- test failed HOT 4
- python printing is broken HOT 9
- ShellUTest fails because of NumberNode formatting change HOT 5
- "make tests" fails to build PyEvalUTest HOT 9
- Python cogserver AWOL
- make check fails trying to find PyIncludeWrapper.h HOT 3
- CythonServer test fails libtruthvalue.so: undefined symbol: _ZN7opencog14EvaluationLink11do_evaluateEPNS_9AtomSpaceERKNS_6HandleEb HOT 6
- ShellUTest fails HOT 2
- python shell handling is broken. HOT 4
- Cogserver unclean shutdown HOT 2
- CogServer does not error on module load failure HOT 3
- ShellUTest errors sometimes with Debug build HOT 22
- Split up cogserver into three parts. HOT 4
- Cogserver and attention circular dependencies? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cogserver.