Coder Social home page Coder Social logo

Comments (58)

linas avatar linas commented on June 2, 2024

Wow! Cool! I think I see what the problem is, and how to fix it, but it will require a bit of patience from you.

About 6 months ago (circa November 2021) The AtomSpace was switched to use a C++ smart-pointer to hold references. This means that you can no longer use AtomSpace * p = new AtomSpace() in your code; you must use AtomSpacePtr p = createAtomSpace() instead. The older style might work, sometimes; depending on C++ implementation details. (I've seen it work! Surprising but true!) but overall, you must port to the new style, in order to get things to work.

More details in the next comment.

from atomspace.

linas avatar linas commented on June 2, 2024

A C++ smart pointer is three words: one word is a pointer to the "actual object", plus an atomic, plus some other stuff - messy low-level CPU stuff. To use this in your jni code, you have to treat it excactly the same way that you treat Handle. In fact, you can cast to/from AtomSpacePtr and Handle.

So, in your com_cogroid_atomspace_whatever.cc file, you need code similar to this pseudocode:

JNIEXPORT jlong JNICALL Java_com_cogroid_atomspace_something
  (JNIEnv *env, jobject thisObj, jlong as_jni_ptr) {
    opencog::AtomSpacePtr *ptr_to_asp = NULL;
    if (as_jni_ptr != 0) {
        ptr_to_asp = new AtomSpacePtr(); // create a new smart pointer
        *ptr_to_asp = createAtomSpace();  // create a new AtomSpace and assign it to the smart ptr.
    }

    // equivalently, the following would work:
    AtomSpacePtr asp = createAtomSpace();
    void* ptr_to_ptr = malloc(sizeof (AtomSpaacePtr));
    AtomSpacePtr* pasp = ptr_to_ptr;
    *pasp = asp;
    // here, pasp->use_count() prints the usecount,
    // and pasp->get() returns a pointer to the actual AtomSpace

and then, in the destructor/finalizer, you would

     *ptr_to_asp = nullptr;  // decrement use count on the AtomSpace
     delete ptr_to_asp;   // C++ delete the smart pointer.

I hope this makes sense and is clear; if not, let me know.

If you haven't already written code for Handles, you will need to do something similar to the above. If you have working code for handles, then do exactly that.

from atomspace.

linas avatar linas commented on June 2, 2024

More pseudocode. To actually use the AtomSpace, your c++ code would look like this:

... foo(JNIEnv *env, jobject thisObj, jlong as_jni_ptr) {
    void* ptr_to_ptr = (void*) as_jni_ptr;   // get pointer to the 3-word smart pointer.
    AtomSpacePtr* pasp = ptr_to_ptr;  // let C++ know what the 3-word area is.
    AtomSpacePtr asp = *pasp;   // make a copy of the smart pointer. (optional)
    if (nullptr == asp) error();
    asp->any_atomspace_method();
    ...
    // exiting block scope automatically deletes asp. That's fine.
    // print pasp->use_count() if confused.
    // the actual atomspace is at pasp->get() so the following would also work:
    AtomSpace* as = pasp->get();
    as->any_atomspace_method();
}

You don't have to make a copy of the smart pointer, but it will be easier to read the code if you do.

from atomspace.

 avatar commented on June 2, 2024

Wow! Cool! I think I see what the problem is, and how to fix it, but it will require a bit of patience from you.

About 6 months ago (circa November 2021) The AtomSpace was switched to use a C++ smart-pointer to hold references. This means that you can no longer use AtomSpace * p = new AtomSpace() in your code; you must use AtomSpacePtr p = createAtomSpace() instead. The older style might work, sometimes; depending on C++ implementation details. (I've seen it work! Surprising but true!) but overall, you must port to the new style, in order to get things to work.

More details in the next comment.

I don't think that is the problem because I used the same code as createAtomSpace() in creating AtomSpace. Please see following extractions.

opencog/atomspace/AtomSpace.h

...
template< class... Args >
AtomSpacePtr createAtomSpace( Args&&... args )
{
   return std::make_shared<AtomSpace>(std::forward<Args>(args) ...);
}
...

opencog/java/SPW.h

...
template <typename T>
class SPW {
	std::shared_ptr<T> _object;

public:
	template <typename ...ARGS>
	explicit SPW(ARGS... a) {
		_object = std::make_shared<T>(a...);
	}

	explicit SPW(std::shared_ptr<T> obj) {
		_object = obj;
	}

	virtual ~SPW() noexcept = default;

	long instance() {
		return reinterpret_cast<long>(this);
	}

	std::shared_ptr<T> object() {
		return _object;
	}

	T *get() {
		return _object.get();
	}

	static SPW<T> *get(long jni_ptr) {
		return reinterpret_cast<SPW<T> *>(jni_ptr);
	}

	static std::shared_ptr<T> object(long jni_ptr) {
		return get(jni_ptr)->get();
	}

	static long dispose(long jni_ptr) {
		auto obj = get(jni_ptr);
		delete obj;
		return 0;
	}
};
...

opencog/java/com_cogroid_atomspace_AtomSpace.cc

...
JNIEXPORT jlong JNICALL Java_com_cogroid_atomspace_AtomSpace_jni_1init
  (JNIEnv *env, jobject thisObj) {
	cogroid::SPW<opencog::AtomSpace> *spw_asp = new cogroid::SPW<opencog::AtomSpace>();
	return spw_asp->instance();
}
...

from atomspace.

linas avatar linas commented on June 2, 2024

Shouldn't this:

	static std::shared_ptr<T> object(long jni_ptr) {
		return get(jni_ptr)->get();
	}

be this:

	static std::shared_ptr<T> object(long jni_ptr) {
		return get(jni_ptr)->object();
	}

That's because get(jni_ptr) returns SPW<T> *
-- and so get(jni_ptr)->get() returns T*
-- wherereas get(jni_ptr)->object() returns std::shared_ptr<T>.

from atomspace.

linas avatar linas commented on June 2, 2024

However, it does not seem that you actually call the above methods in your code, so that is not the source of the problem. So, some more comments follow, as I review things.

Looking at your tombstone file, I see libguile-2.2.so -- Is guile-3.0 not available for Android? Most of the atomspace will work with guile-2.2 but there are perhaps some minor obscure problem areas where it might not.

from atomspace.

linas avatar linas commented on June 2, 2024

So what's in datomspace-test.txt ? You said "App runs about 30 seconds, then it crashes." -- How far did it get in Tester.java? Did it actually get through at least one call to poll_result()? Or did it fail before the very first begin_eval()?

Tester.java should be modified to keep polling until there is no more output:

       while (true) {
		rs = se.poll_result();
		writeLog("poll_result();");
		writeLog(rs);
                if (rs == "") break;
       }

The reason for this is that you are sending the entire file contents to scheme, in one big lump. If there are multiple scheme blocks in that file, a lot of output might be generated. You should wait for all of it to be processed, before moving to the next file.

There's another design issue, that might cause problems with guile-2.2 -- it does not like long strings. You are taking the contents of each file, and converting it to one big string. That string then is copied into C++, and then the C++ string is copied into a SCM guile object. Then, finally, the guile evaluator runs on the SCM object, and then, much later, the guile garbage collector tries to collect that SCM object. The size of the SCM object is about the same as the size of the input file you provided.

If you are trying to load genetic or protein data from agi-bio, these files can be 50 MBytes or 100MBytes long, containing millions of scheme statements in them. I've noted in the past that if you send strings longer than a few MBytes to the guile-2.2 evaluator, it will run for a while, and then crash in weird ugly ways. I don't know if this is still a problem in guile-3.0 or not.

There are several solutions to this large-file problem, but first, I want to know how far things have gotten... are you able to run any scheme statements at all? Or does it work fine, and only crash much later, after you've already done lots of scheme evals?

from atomspace.

 avatar commented on June 2, 2024

So what's in datomspace-test.txt ? You said "App runs about 30 seconds, then it crashes." -- How far did it get in Tester.java? Did it actually get through at least one call to poll_result()? Or did it fail before the very first begin_eval()?

I failed at following statement:

SchemeEval se = new SchemeEval(pv);

from atomspace.

linas avatar linas commented on June 2, 2024

The tombstone file shows that guile is crashing somewhere inside of gc, and that it has crashed because it tried to touch something about 400 bytes past the end of a 128KByte sized block (at dd880000-dd9fffff rw- 0 180000 [anon:libc_malloc]) Normally, the gc does not run for quite a while -- until you've done a fair amount of computing in scheme. So it seems like ... some fair amount of scheme code must have already been run. If so, then ... well, debugging gets a bit harder.

For your test files in Tester.java you should try things like

(+ 2 2)
(gc)
(display "Hello world\n")
(gc)
(gc-stats)

You could try that in one file, or even better: four files, one line each. Does that work?

from atomspace.

linas avatar linas commented on June 2, 2024

whoops we posted at the same time. One moment, let me review...

from atomspace.

linas avatar linas commented on June 2, 2024

It failed at following statement:

SchemeEval se = new SchemeEval(pv);

Are you sure? That does not match the tombstone file. (I should have looked at the tombstone file more carefully; I would have been able to answer my own questions.) The tombstone file shows a crash in this code:

static void immortal_thread(void)
{
   scm_with_guile(c_wrap_init_only_once, NULL);
   set_thread_name("atoms:immortal");

which means that it already crashed in your java wrapper SchemeEval.init_scheme(); so this should not have advanced past that.

So the questions are:

  • Are you sure that SchemeEval.init_scheme(); finished and returned?
  • If so, then double-check to see if the tombstone file looks the same as before
  • If it does, then we need to understand how/why SchemeEval.init_scheme(); returned even though the stack trace shows that it's still running in there ...

from atomspace.

linas avatar linas commented on June 2, 2024

I need to eat dinner now. What timezone are you in? Perhaps a chat on discord might be faster?

from atomspace.

linas avatar linas commented on June 2, 2024

I created a version with debug printfs that surround the area that crashes in in the tombstone. You can get it from there: https://github.com/linas/atomspace/tree/android-dbg
so, maybe like this:

cd atomspace-git
git checkout -b arm-dbg
git pull https://github.com/linas/atomspace/ android-dbg
cd build; make; make install

Then capture the prints to stdout and post those.


BTW, there is also a completely different possibility, too. Can you get a guile shell? If so, then the following should work:

(use-modules (opencog))
(Concept "foo")

from atomspace.

 avatar commented on June 2, 2024

I created a version with debug printfs that surround the area that crashes in in the tombstone. You can get it from there: https://github.com/linas/atomspace/tree/android-dbg so, maybe like this:

cd atomspace-git
git checkout -b arm-dbg
git pull https://github.com/linas/atomspace/ android-dbg
cd build; make; make install

Then capture the prints to stdout and post those.

BTW, there is also a completely different possibility, too. Can you get a guile shell? If so, then the following should work:

(use-modules (opencog))
(Concept "foo")

I don't know how to capture stdout and stderr on Android app. Can you write logs to /storage/emulated/0/Download/datomspace-test.txt file?

from atomspace.

 avatar commented on June 2, 2024

I am thinking of that in case of this issue can not be fixed, I can write a simulated SchemeEval class which converts scheme code to javascript using scheme2js, then runs javascript code in Atomize - JavaScript Sandbox for AtomSpace.

from atomspace.

 avatar commented on June 2, 2024

Atomize - JavaScript Sandbox for AtomSpace now can convert scheme code to javascript using scheme2js and can run it.

If this issue can not be fixed, I will write SchemeEval class which contains a flag for simulating or not. If simulating is true, it will convert scheme code to javascript and then run it. If simulating is false, it will call SchemeEval class of AtomSpace.


Atomize - JavaScript Sandbox for AtomSpace

Release

Atomize 0.2

dAtomSpace Tester with Atomize

Install & Run dAtomSpace Tester with Atomize

  1. Download datomspace-tester.apk

  2. Install datomspace-tester.apk (Do not run!)

  3. Go to Settings -> Apps -> dAtomSpace Tester. Set Storage permission.

  4. Run dAtomSpace Tester

  5. View results in datomspace-test.txt file in Download folder

from atomspace.

linas avatar linas commented on June 2, 2024

in case of this issue can not be fixed

I'm fairly certain the issue is in some code that we control, and thus can be fixed.

scheme2js

This won't work: there is some heavy/complicated interfacing to call c++ code from scheme (and vice-versa).

Install datomspace-tester.apk

How do I install?

write logs to /storage/emulated/0/Download/datomspace-test.txt

I'll do that in just a few minutes.

from atomspace.

linas avatar linas commented on June 2, 2024

write logs to /storage/emulated/0/Download/datomspace-test.txt

Done. Edit opencog/guile/SchemeEval.cc if you need to change this (its in two places)

from atomspace.

 avatar commented on June 2, 2024

Install datomspace-tester.apk

How do I install?

  1. You open this issue's comment on your Android phone.
  2. Download datomspace-tester.apk
  3. Open your Download folder. Tap on datomspace-tester.apk file.
  4. Your phone will show confirmation box with message: "For security, your phone is set to block installation of apps obtained from unknown sources.". Tap on "Settings". Turn on "Unknown sources" (Allow the installation of apps from sources other than Play Store or Galaxy Apps.). Your phone will show confirmation box. Tap on "OK" button. The app will be installed. Do not choose close and run after app is installed.
  5. Go to Settings -> Apps -> dAtomSpace Tester. Set Storage permission.
  6. Run the app

from atomspace.

 avatar commented on June 2, 2024

scheme2js

This won't work: there is some heavy/complicated interfacing to call c++ code from scheme (and vice-versa).

I think it will work. The process is javascript <--> java <--> jni C code <--> AtomSpace classes.

(ConceptNode "dream") will be converted to ConceptNode("dream"). So I have to add function definition "function ConceptNode(name) { }". I have to test and add all function definitions which are available on scheme files of AtomSpace.

However, this process will be very slow. So it is better if this issue is fixed.

from atomspace.

linas avatar linas commented on June 2, 2024

The process is javascript <--> java <--> jni C code <--> AtomSpace classes.

Naively, that is correct, but you are vastly underestimating the actual complexity. The code in SchemeEval.cc is big and bloated not because it's guile, but because there's dozens of needed functions in there. Plus also SchemePrimitive.h. It's .. complicated.

How do I install?

OK I will try that, but I would like it much better if you did most of the work. Don't make me do things that give me headaches ...

from atomspace.

linas avatar linas commented on June 2, 2024

OK, I've installed. I now see a plain panel. At the top it says "dAtomSpace Tester" and then
URL: and then a red line, a blinking cursor on the red line, a button next to the red line that says "DOWNLOAD & RUN" and then a blank white page. At the very bottom: it says

Log File:
/storage/sdcard0/Download/datomspace-test.txt

Note that my logfile is in a different location from yours.

from atomspace.

 avatar commented on June 2, 2024

OK, I've installed. I now see a plain panel. At the top it says "dAtomSpace Tester" and then URL: and then a red line, a blinking cursor on the red line, a button next to the red line that says "DOWNLOAD & RUN" and then a blank white page. At the very bottom: it says

Log File:
/storage/sdcard0/Download/datomspace-test.txt

Note that my logfile is in a different location from yours.

You open 'Download' folder, then view datomspace-test.txt file for results.

from atomspace.

 avatar commented on June 2, 2024

After I compile AtomSpace with your SchemeEval.cc and run, I receive datomspace-test.txt file as:



===== PseudoValue =====


isAtom: true

isNode: false

isLink: false

isType: true

disposed: true


===== AtomSpace =====


isAtom: true

isNode: false

isLink: false

isType: true

getHash: 2

toString(indent): indent(AtomSpace "(uuid . 2)")

toShortString(indent): indent(AtomSpace "(uuid . 2)")

disposed: true


===== SchemeEval =====

duude enter init_scheme tid=7776
duude enter SchemeEval() ctor tid=7776 this=0xff80c134 as=0x0
duude enter init_only_once done=0
duude init_only_once gonna make immortal me=7776
duude init_only_once done make immortal me=7776
duude enter immortal tid=7818

from atomspace.

 avatar commented on June 2, 2024

This is tombstone file.

from atomspace.

linas avatar linas commented on June 2, 2024

And then what ... I guess it hangs after the enter immortal tid=7818? Is it a hang, or a crash?
It should have printed this:

duude enter immortal tid=7818
duude enter cwrap_niit_only_once tid=7818
duude exit cwrap_niit_only_once tid=7818
duude immortal done with guile init tid=7818
duude return from init_only_once me=7776
duude in SchemeEval() ctor before wrap_init this=0x55aae3c7de40
duude in SchemeEval() ctor after wrap_init this=0x55aae3c7de40

When I do it, and look at the text file, I don't see any of what you have above. Instead, I get a java stack trace that looks like its due to my clicking on the "INSTALL & RUN" button, with the bad URL.

It says something like ENOENT file not found (that's a standard error message, its coming from guile-snarf (so it seems guile is running) and then java.io.FileStream and com.cogroid.atomspace.tester.MainActivity.unzipFile(MainActivity.java:512) and more which looks like a very ordinary file-not-found error because my URL was bad ...

from atomspace.

 avatar commented on June 2, 2024

When I do it, and look at the text file, I don't see any of what you have above. Instead, I get a java stack trace that looks like its due to my clicking on the "INSTALL & RUN" button, with the bad URL.

It says something like ENOENT file not found (that's a standard error message, its coming from guile-snarf (so it seems guile is running) and then java.io.FileStream and com.cogroid.atomspace.tester.MainActivity.unzipFile(MainActivity.java:512) and more which looks like a very ordinary file-not-found error because my URL was bad ...

That is caused by that the app has not permission to write to sdcard. You have to set permission for the app and run again.

from atomspace.

linas avatar linas commented on June 2, 2024

There's no tombstone file in the Download directory. The datomspace-test.txt file just reports my failed URL attempts. I picked a file that looked OK .. I get this:

===== /storage/sdcard0/Download/jsb/fs/ConceptNode.scm

java.net.MalformedURLException: etc.
com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.downloadFile(MainActivity.java:170)
etc.

I tried other variants, but none worked.

from atomspace.

linas avatar linas commented on June 2, 2024

I looked at your tombstone file .. it looks a lot like your earlier one. The stack trace is more or less the same as before. ... its crashing in the GC. The printf's affirm the stack trace in the tombstone file: immortal_thread(void) was called, which then calls scm_with_guile(c_wrap_init_only_once, NULL); There is a print statement in c_wrap_init_only_once but that printf never happens. This is consistent with the tombstone stack.

As before, the GC crashed trying to access some invalid address. This time, the address is different than before; this time, its some unlabelled 4K page between some shared libs, not too far away from a libc_malloc pool. Close enough that it's plausible that the GC wanted to search the malloc pool, got confused, and wandered away from the pool to a nearby area.

This suggests that there's a bug with the GC. If this is happening only on arm, and you've tested on non-arm android, then ... (I'm confused .. did you test on non-arm android? or some non-arm java system? ) ...

The easiest thing to try is to find some other version of the GC, ideally a newer version, and see if that works. Trying older versions are worthwhile, too.

A little bit harder is to download the code for the gc, and compile it yourself (its not hard) and see if that works. It's bdw-gc.

Can you explain what is happening on my phone? Did the atomspace initialize, or not? Did guile initialize, or not, on my phone?

from atomspace.

linas avatar linas commented on June 2, 2024

That is caused by that the app has not permission to write to sdcard.

But it wrote to the txt file just fine! And the txt file is on the sdcard, in the Download directory.

from atomspace.

 avatar commented on June 2, 2024

There's no tombstone file in the Download directory. The datomspace-test.txt file just reports my failed URL attempts. I picked a file that looked OK .. I get this:

===== /storage/sdcard0/Download/jsb/fs/ConceptNode.scm

java.net.MalformedURLException: etc.
com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.downloadFile(MainActivity.java:170)
etc.

I tried other variants, but none worked.

Please try following URL: https://github.com/cogroid/d-atomize-bin/raw/main/samples/Tests.js. The URL is for javascript file in JavaScript Sandbox format which contains following function:

function __exec__(data) {

}

from atomspace.

 avatar commented on June 2, 2024

This suggests that there's a bug with the GC. If this is happening only on arm, and you've tested on non-arm android, then ... (I'm confused .. did you test on non-arm android? or some non-arm java system? ) ...

I tested on non-arm java system (java 64bit and 32bit for linux). On that systems, it worked well.

from atomspace.

 avatar commented on June 2, 2024

Can you explain what is happening on my phone? Did the atomspace initialize, or not? Did guile initialize, or not, on my phone?

Without log file, I don't know what happens on your phone. Can you do following?

  1. Close dAtomSpace Tester
  2. Delete datomspace-test.txt on Download folder
  3. Run dAtomSpace Tester. Wait for 2 minutes.
  4. Open datomspace-test.txt on Download folder and post its contents here

With dAtomSpace Tester which you download here, atomspace can be initialized but guile is not initialized because it is not called (if it is called, it will crash).

from atomspace.

 avatar commented on June 2, 2024

The easiest thing to try is to find some other version of the GC, ideally a newer version, and see if that works. Trying older versions are worthwhile, too.

A little bit harder is to download the code for the gc, and compile it yourself (its not hard) and see if that works. It's bdw-gc.

I am building gc-8.0.6.tar.gz. When it will complete, I will update log file and tombstone file.

from atomspace.

 avatar commented on June 2, 2024

The easiest thing to try is to find some other version of the GC, ideally a newer version, and see if that works. Trying older versions are worthwhile, too.
A little bit harder is to download the code for the gc, and compile it yourself (its not hard) and see if that works. It's bdw-gc.

I am building gc-8.0.6.tar.gz. When it will complete, I will update log file and tombstone file.

I built gc-8.0.6.tar.gz and results were:



===== PseudoValue =====


isAtom: true

isNode: false

isLink: false

isType: true

disposed: true


===== AtomSpace =====


isAtom: true

isNode: false

isLink: false

isType: true

getHash: 2

toString(indent): indent(AtomSpace "(uuid . 2)")

toShortString(indent): indent(AtomSpace "(uuid . 2)")

disposed: true


===== SchemeEval =====

duude enter init_scheme tid=19464
duude enter SchemeEval() ctor tid=19464 this=0xff80c12c as=0x0
duude enter init_only_once done=0
duude init_only_once gonna make immortal me=19464
duude init_only_once done make immortal me=19464
duude enter immortal tid=19502

This is tombstone file.

from atomspace.

 avatar commented on June 2, 2024

I removed *.go from cache folder of guile package and it did not crash. But it runs too long, may be it compile *.scm files.

from atomspace.

linas avatar linas commented on June 2, 2024

I removed *.go from cache folder of guile package and it did not crash. But it runs too long, may be it compile *.scm files.

Ah! This is interesting! But now I am very confused -- I thought that only guile-3.0 used *.go files, and that you were using only guile-2.2 !??

Yes, the *.go files contain guile bytecode; yes, they are the result of compiling *.scm files. And yes, they take a very long time to compile - painfully long -- several minutes on my main desktop. However, the compile is done only once; The second and later startup should be fast. Removing the *.go files will cause a recompile. Sometimes (but not always) changing the *.scm files will cause a recompile. On rare occasions, one can have stale *.go files that are broken, and exhibit crazy nonsense errors. This happens once or twice a year for me...

I have no idea if the *.go files are architecture-dependent. They might contain amd64 or i386 assembly in them. There might be differences in stack-growth direction, memory mapping, endian-ness. Differences in how scheme objects are laid out in memory.

The safe solution is to remove the *.go files, compile them once, on arm, and then ship the new *.go files as a part of the apk. The compilation should happen automatically, but there is also a way to trigger it manually. I've never done a manual compile for the atomspace ...

from atomspace.

linas avatar linas commented on June 2, 2024

Huh apparently, guile-2.2 also creates *.go files. OK, I'd forgotten about that. I did find some go files in your opencog/java/data/armv7/guile.zip but those are go files for the guile system. Compiling those will take hours. Maybe many hours. I did not see any opencog *.go files in there. For fast startup, you will need to provide opencog *.go files, too.

from atomspace.

linas avatar linas commented on June 2, 2024

Here's the full contents of the file (as of last night) Note that sometimes I get guile-snarf errors, and sometimes not. The first thing I did was to try to open an empty URL:

java.io.FileNotFoundException: /storage/emulated/0/guile/bin/guile-snarf: open failed: ENOENT (No such file or directory)
	at libcore.io.IoBridge.open(IoBridge.java:453)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:88)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:73)
	at com.cogroid.atomspace.tester.MainActivity.unzipFile(MainActivity.java:512)
	at com.cogroid.atomspace.tester.MainActivity$RunTestsRunnable.run(MainActivity.java:124)
	at android.os.Handler.handleCallback(Handler.java:808)
	at android.os.Handler.dispatchMessage(Handler.java:103)
	at android.os.Looper.loop(Looper.java:193)
	at android.app.ActivityThread.main(ActivityThread.java:5292)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:515)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:641)
	at dalvik.system.NativeStart.main(Native Method)
Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
	at libcore.io.Posix.open(Native Method)
	at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
	at libcore.io.IoBridge.open(IoBridge.java:437)
	... 13 more


=====  =====

java.net.MalformedURLException: Protocol not found: 
	at java.net.URL.<init>(URL.java:176)
	at java.net.URL.<init>(URL.java:125)
	at com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.downloadFile(MainActivity.java:170)
	at com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.doInBackground(MainActivity.java:206)
	at android.os.AsyncTask$2.call(AsyncTask.java:288)
	at java.util.concurrent.FutureTask.run(FutureTask.java:237)
	at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
	at java.lang.Thread.run(Thread.java:841)


===== aaaa =====

java.net.MalformedURLException: Protocol not found: aaaa
	at java.net.URL.<init>(URL.java:176)
	at java.net.URL.<init>(URL.java:125)
	at com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.downloadFile(MainActivity.java:170)
	at com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.doInBackground(MainActivity.java:206)
	at android.os.AsyncTask$2.call(AsyncTask.java:288)
	at java.util.concurrent.FutureTask.run(FutureTask.java:237)
	at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
	at java.lang.Thread.run(Thread.java:841)


===== aaaa =====

java.net.MalformedURLException: Protocol not found: aaaa
	at java.net.URL.<init>(URL.java:176)
	at java.net.URL.<init>(URL.java:125)
	at com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.downloadFile(MainActivity.java:170)
	at com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.doInBackground(MainActivity.java:206)
	at android.os.AsyncTask$2.call(AsyncTask.java:288)
	at java.util.concurrent.FutureTask.run(FutureTask.java:237)
	at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
	at java.lang.Thread.run(Thread.java:841)


===== aaaa =====

java.net.MalformedURLException: Protocol not found: aaaa
	at java.net.URL.<init>(URL.java:176)
	at java.net.URL.<init>(URL.java:125)
	at com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.downloadFile(MainActivity.java:170)
	at com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.doInBackground(MainActivity.java:206)
	at android.os.AsyncTask$2.call(AsyncTask.java:288)
	at java.util.concurrent.FutureTask.run(FutureTask.java:237)
	at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
	at java.lang.Thread.run(Thread.java:841)


===== aaaa =====

java.net.MalformedURLException: Protocol not found: aaaa
	at java.net.URL.<init>(URL.java:176)
	at java.net.URL.<init>(URL.java:125)
	at com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.downloadFile(MainActivity.java:170)
	at com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.doInBackground(MainActivity.java:206)
	at android.os.AsyncTask$2.call(AsyncTask.java:288)
	at java.util.concurrent.FutureTask.run(FutureTask.java:237)
	at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
	at java.lang.Thread.run(Thread.java:841)


===== aaaa =====

java.net.MalformedURLException: Protocol not found: aaaa
	at java.net.URL.<init>(URL.java:176)
	at java.net.URL.<init>(URL.java:125)
	at com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.downloadFile(MainActivity.java:170)
	at com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.doInBackground(MainActivity.java:206)
	at android.os.AsyncTask$2.call(AsyncTask.java:288)
	at java.util.concurrent.FutureTask.run(FutureTask.java:237)
	at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
	at java.lang.Thread.run(Thread.java:841)


===== aaaa =====

java.net.MalformedURLException: Protocol not found: aaaa
	at java.net.URL.<init>(URL.java:176)
	at java.net.URL.<init>(URL.java:125)
	at com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.downloadFile(MainActivity.java:170)
	at com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.doInBackground(MainActivity.java:206)
	at android.os.AsyncTask$2.call(AsyncTask.java:288)
	at java.util.concurrent.FutureTask.run(FutureTask.java:237)
	at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
	at java.lang.Thread.run(Thread.java:841)


===== jsb/js/ConceptNode.js =====

java.net.MalformedURLException: Protocol not found: jsb/js/ConceptNode.js
	at java.net.URL.<init>(URL.java:176)
	at java.net.URL.<init>(URL.java:125)
	at com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.downloadFile(MainActivity.java:170)
	at com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.doInBackground(MainActivity.java:206)
	at android.os.AsyncTask$2.call(AsyncTask.java:288)
	at java.util.concurrent.FutureTask.run(FutureTask.java:237)
	at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
	at java.lang.Thread.run(Thread.java:841)


===== jsb/js/ConceptNode.js =====

java.net.MalformedURLException: Protocol not found: jsb/js/ConceptNode.js
	at java.net.URL.<init>(URL.java:176)
	at java.net.URL.<init>(URL.java:125)
	at com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.downloadFile(MainActivity.java:170)
	at com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.doInBackground(MainActivity.java:206)
	at android.os.AsyncTask$2.call(AsyncTask.java:288)
	at java.util.concurrent.FutureTask.run(FutureTask.java:237)
	at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
	at java.lang.Thread.run(Thread.java:841)


===== jsb/js/ConceptNode.js =====

java.net.MalformedURLException: Protocol not found: jsb/js/ConceptNode.js
	at java.net.URL.<init>(URL.java:176)
	at java.net.URL.<init>(URL.java:125)
	at com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.downloadFile(MainActivity.java:170)
	at com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.doInBackground(MainActivity.java:206)
	at android.os.AsyncTask$2.call(AsyncTask.java:288)
	at java.util.concurrent.FutureTask.run(FutureTask.java:237)
	at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
	at java.lang.Thread.run(Thread.java:841)


===== jsb/fs/ConceptNode.js =====

java.net.MalformedURLException: Protocol not found: jsb/fs/ConceptNode.js
	at java.net.URL.<init>(URL.java:176)
	at java.net.URL.<init>(URL.java:125)
	at com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.downloadFile(MainActivity.java:170)
	at com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.doInBackground(MainActivity.java:206)
	at android.os.AsyncTask$2.call(AsyncTask.java:288)
	at java.util.concurrent.FutureTask.run(FutureTask.java:237)
	at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
	at java.lang.Thread.run(Thread.java:841)


===== jsb/fs/ConceptNode.js =====

java.net.MalformedURLException: Protocol not found: jsb/fs/ConceptNode.js
	at java.net.URL.<init>(URL.java:176)
	at java.net.URL.<init>(URL.java:125)
	at com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.downloadFile(MainActivity.java:170)
	at com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.doInBackground(MainActivity.java:206)
	at android.os.AsyncTask$2.call(AsyncTask.java:288)
	at java.util.concurrent.FutureTask.run(FutureTask.java:237)
	at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
	at java.lang.Thread.run(Thread.java:841)


===== jsb/fs/ConceptNode.js =====

java.net.MalformedURLException: Protocol not found: jsb/fs/ConceptNode.js
	at java.net.URL.<init>(URL.java:176)
	at java.net.URL.<init>(URL.java:125)
	at com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.downloadFile(MainActivity.java:170)
	at com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.doInBackground(MainActivity.java:206)
	at android.os.AsyncTask$2.call(AsyncTask.java:288)
	at java.util.concurrent.FutureTask.run(FutureTask.java:237)
	at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
	at java.lang.Thread.run(Thread.java:841)


===== /storage/sdcard0/Download/jsb/fs/ConceptNode.js =====

java.net.MalformedURLException: Protocol not found: /storage/sdcard0/Download/jsb/fs/ConceptNode.js
	at java.net.URL.<init>(URL.java:176)
	at java.net.URL.<init>(URL.java:125)
	at com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.downloadFile(MainActivity.java:170)
	at com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.doInBackground(MainActivity.java:206)
	at android.os.AsyncTask$2.call(AsyncTask.java:288)
	at java.util.concurrent.FutureTask.run(FutureTask.java:237)
	at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
	at java.lang.Thread.run(Thread.java:841)


===== /storage/sdcard0/Download/jsb/fs/ConceptNode.js =====

java.net.MalformedURLException: Protocol not found: /storage/sdcard0/Download/jsb/fs/ConceptNode.js
	at java.net.URL.<init>(URL.java:176)
	at java.net.URL.<init>(URL.java:125)
	at com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.downloadFile(MainActivity.java:170)
	at com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.doInBackground(MainActivity.java:206)
	at android.os.AsyncTask$2.call(AsyncTask.java:288)
	at java.util.concurrent.FutureTask.run(FutureTask.java:237)
	at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
	at java.lang.Thread.run(Thread.java:841)


===== /storage/sdcard0/Download/jsb/fs/ConceptNode.js =====

java.net.MalformedURLException: Protocol not found: /storage/sdcard0/Download/jsb/fs/ConceptNode.js
	at java.net.URL.<init>(URL.java:176)
	at java.net.URL.<init>(URL.java:125)
	at com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.downloadFile(MainActivity.java:170)
	at com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.doInBackground(MainActivity.java:206)
	at android.os.AsyncTask$2.call(AsyncTask.java:288)
	at java.util.concurrent.FutureTask.run(FutureTask.java:237)
	at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
	at java.lang.Thread.run(Thread.java:841)


java.io.FileNotFoundException: /storage/emulated/0/guile/bin/guile-snarf: open failed: ENOENT (No such file or directory)
	at libcore.io.IoBridge.open(IoBridge.java:453)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:88)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:73)
	at com.cogroid.atomspace.tester.MainActivity.unzipFile(MainActivity.java:512)
	at com.cogroid.atomspace.tester.MainActivity$RunTestsRunnable.run(MainActivity.java:124)
	at android.os.Handler.handleCallback(Handler.java:808)
	at android.os.Handler.dispatchMessage(Handler.java:103)
	at android.os.Looper.loop(Looper.java:193)
	at android.app.ActivityThread.main(ActivityThread.java:5292)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:515)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:641)
	at dalvik.system.NativeStart.main(Native Method)
Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
	at libcore.io.Posix.open(Native Method)
	at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
	at libcore.io.IoBridge.open(IoBridge.java:437)
	... 13 more


===== fff =====

java.net.MalformedURLException: Protocol not found: fff
	at java.net.URL.<init>(URL.java:176)
	at java.net.URL.<init>(URL.java:125)
	at com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.downloadFile(MainActivity.java:170)
	at com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.doInBackground(MainActivity.java:206)
	at android.os.AsyncTask$2.call(AsyncTask.java:288)
	at java.util.concurrent.FutureTask.run(FutureTask.java:237)
	at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
	at java.lang.Thread.run(Thread.java:841)

from atomspace.

linas avatar linas commented on June 2, 2024

And then this with the URL you suggested:

===== https://github.com/cogroid/d-atomize-bin/raw/main/samples/Tests.js =====

javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x62a53638: Failure in SSL library, usually a protocol error
error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure (external/openssl/ssl/s23_clnt.c:741 0x5ef866fd:0x00000000)
	at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:448)
	at com.android.okhttp.Connection.upgradeToTls(Connection.java:146)
	at com.android.okhttp.Connection.connect(Connection.java:107)
	at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:294)
	at com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255)
	at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206)
	at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:355)
	at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:306)
	at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:513)
	at com.android.okhttp.internal.http.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:136)
	at com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.downloadFile(MainActivity.java:172)
	at com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.doInBackground(MainActivity.java:206)
	at android.os.AsyncTask$2.call(AsyncTask.java:288)
	at java.util.concurrent.FutureTask.run(FutureTask.java:237)
	at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
	at java.lang.Thread.run(Thread.java:841)
Caused by: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x62a53638: Failure in SSL library, usually a protocol error
error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure (external/openssl/ssl/s23_clnt.c:741 0x5ef866fd:0x00000000)
	at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method)
	at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:405)
	... 17 more

from atomspace.

linas avatar linas commented on June 2, 2024

And one more try:

===== file://storage/sdcard0/Download/jsb/fs/Tests.js =====

java.lang.ClassCastException: libcore.net.url.FtpURLConnection cannot be cast to java.net.HttpURLConnection
	at com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.downloadFile(MainActivity.java:171)
	at com.cogroid.atomspace.tester.MainActivity$DownloadRunTask.doInBackground(MainActivity.java:206)
	at android.os.AsyncTask$2.call(AsyncTask.java:288)
	at java.util.concurrent.FutureTask.run(FutureTask.java:237)
	at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
	at java.lang.Thread.run(Thread.java:841)


java.io.FileNotFoundException: /storage/emulated/0/guile/bin/guile-snarf: open failed: ENOENT (No such file or directory)
	at libcore.io.IoBridge.open(IoBridge.java:453)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:88)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:73)
	at com.cogroid.atomspace.tester.MainActivity.unzipFile(MainActivity.java:512)
	at com.cogroid.atomspace.tester.MainActivity$RunTestsRunnable.run(MainActivity.java:124)
	at android.os.Handler.handleCallback(Handler.java:808)
	at android.os.Handler.dispatchMessage(Handler.java:103)
	at android.os.Looper.loop(Looper.java:193)
	at android.app.ActivityThread.main(ActivityThread.java:5292)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:515)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:641)
	at dalvik.system.NativeStart.main(Native Method)
Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
	at libcore.io.Posix.open(Native Method)
	at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
	at libcore.io.IoBridge.open(IoBridge.java:437)
	... 13 more


java.io.FileNotFoundException: /storage/emulated/0/guile/bin/guile-snarf: open failed: ENOENT (No such file or directory)
	at libcore.io.IoBridge.open(IoBridge.java:453)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:88)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:73)
	at com.cogroid.atomspace.tester.MainActivity.unzipFile(MainActivity.java:512)
	at com.cogroid.atomspace.tester.MainActivity$RunTestsRunnable.run(MainActivity.java:124)
	at android.os.Handler.handleCallback(Handler.java:808)
	at android.os.Handler.dispatchMessage(Handler.java:103)
	at android.os.Looper.loop(Looper.java:193)
	at android.app.ActivityThread.main(ActivityThread.java:5292)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:515)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:641)
	at dalvik.system.NativeStart.main(Native Method)
Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
	at libcore.io.Posix.open(Native Method)
	at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
	at libcore.io.IoBridge.open(IoBridge.java:437)
	... 13 more


java.io.FileNotFoundException: /storage/emulated/0/guile/bin/guile-snarf: open failed: ENOENT (No such file or directory)
	at libcore.io.IoBridge.open(IoBridge.java:453)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:88)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:73)
	at com.cogroid.atomspace.tester.MainActivity.unzipFile(MainActivity.java:512)
	at com.cogroid.atomspace.tester.MainActivity$RunTestsRunnable.run(MainActivity.java:124)
	at android.os.Handler.handleCallback(Handler.java:808)
	at android.os.Handler.dispatchMessage(Handler.java:103)
	at android.os.Looper.loop(Looper.java:193)
	at android.app.ActivityThread.main(ActivityThread.java:5292)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:515)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:641)
	at dalvik.system.NativeStart.main(Native Method)
Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
	at libcore.io.Posix.open(Native Method)
	at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
	at libcore.io.IoBridge.open(IoBridge.java:437)
	... 13 more

from atomspace.

linas avatar linas commented on June 2, 2024

OK, so on my phone:

  • I get java errors if I try to open https:// or file:/ URL's. -- I don;'t understand why.
  • Sometimes, I get this error: /storage/emulated/0/guile/bin/guile-snarf -- I can explain this: my phone does not have a /storage/emulated folder. So apparently, this is a hard-coded path, somewhere ...

I can see that inside of guile.zip you do have ./guile/bin/guile-snarf and also ./guile/bin/guile but I do not know how to run these ...

I have a terminal emulator installed on my phone, but the unzip command is missing, so I cannot unpack. I am now trying to copy the unzipped files from my desktop to my phone, but its incredibly slow: 5kB/sec, will take 5 hours to copy 49 MB. So I will try running the guile shell by hand, later. I suspect it will not work, because the install paths will be all wrong ... it would be nice if I could do this.

from atomspace.

linas avatar linas commented on June 2, 2024

Your new tombstone is interesting: the stack trace is:

backtrace:
    #00 pc 0004ad30  /system/lib/libc.so (tgkill+12)
    #01 pc 000484c3  /system/lib/libc.so (pthread_kill+34)
    #02 pc 0001dd99  /system/lib/libc.so (raise+10)
    #03 pc 0002b743  /data/app/com.cogroid.atomspace.tester-1/lib/arm/libgc.so (__aeabi_idiv0+6)
    #04 pc 000a5e1f  /data/app/com.cogroid.atomspace.tester-1/lib/arm/libguile-2.2.so (scm_weak_table_refq+98)
    #05 pc 0004184f  /data/app/com.cogroid.atomspace.tester-1/lib/arm/libguile-2.2.so (scm_i_define_class_for_vtable+74)
    #06 pc 0009243f  /data/app/com.cogroid.atomspace.tester-1/lib/arm/libguile-2.2.so (scm_set_struct_vtable_name_x+90)
    #07 pc 0009874d  /data/app/com.cogroid.atomspace.tester-1/lib/arm/libguile-2.2.so (vm_regular_engine+1120)
    #08 pc 000976af  /data/app/com.cogroid.atomspace.tester-1/lib/arm/libguile-2.2.so (scm_call_n+270)
    #09 pc 0004f9ad  /data/app/com.cogroid.atomspace.tester-1/lib/arm/libguile-2.2.so (scm_primitive_load_path+464)
    #10 pc 0004803b  /data/app/com.cogroid.atomspace.tester-1/lib/arm/libguile-2.2.so (scm_i_init_guile+774)
    #11 pc 0009358d  /data/app/com.cogroid.atomspace.tester-1/lib/arm/libguile-2.2.so (scm_i_init_thread_for_guile+100)
    #12 pc 00094e7b  /data/app/com.cogroid.atomspace.tester-1/lib/arm/libguile-2.2.so (with_guile+14)
    #13 pc 00024f94  /data/app/com.cogroid.atomspace.tester-1/lib/arm/libgc.so (GC_call_with_stack_base+44)
    #14 pc 000935db  /data/app/com.cogroid.atomspace.tester-1/lib/arm/libguile-2.2.so (scm_with_guile+34)
    #15 pc 001aa130  /data/app/com.cogroid.atomspace.tester-1/lib/arm/libdatomspace.so (_ZL15immortal_threadv+68)
    #16 pc 001aa278  /data/app/com.cogroid.atomspace.tester-1/lib/arm/libdatomspace.so (_ZNSt6__ndk114__thread_proxyINS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEEPFvvEEEEEEPvSA_+40)
    #17 pc 00047f93  /system/lib/libc.so (_ZL15__pthread_startPv+22)
    #18 pc 0001a161  /system/lib/libc.so (__start_thread+6)

The scm_weak_table_ref and scm_i_whatever are ordinary C subroutines in guile. They look great, exactly as they should be.

This line looks suspicious or wrong:

    #03 pc 0002b743  /data/app/com.cogroid.atomspace.tester-1/lib/arm/libgc.so (__aeabi_idiv0+6)

So eabi says this is part of the ABI (for arm7, I guess) and idiv0 suggests that this is supposed to be arm7 emulation code for integer division (I'm guessing here...) and then it raises an exception 6 bytes in. This suggests that the exception is in trampoline code or shared lib glue code or something like that. This suggests that libgc.so is incompletely linked, or has missing symbols or was compiled for the wrong architecture. One way to debug this is to disassemble __aeabi_idiv0 and look what is happening 6 bytes in. It's presumably telling the linker-loader to do something insane...

The good news is that guile itself looks OK. The bad news is that either libgc.so is bad, or that maybe you didn't relink your version of guile to the new libgc? And so the linker loader is using bad offsets or something like that?

from atomspace.

 avatar commented on June 2, 2024

Calling SchemeEval class does not crash but it run forever without any output although I have redirected stdout & stderr to files.


INFO: Readonly settings: {}

INFO: Writable settings: {}

INFO: ===== /AtomSpace.js =====

INFO: Readonly settings: {}

INFO: Writable settings: {}

INFO: isAtom: true

INFO: isNode: false

INFO: isLink: false

INFO: isType: true

INFO: getHash: 1

INFO: toString(indent): indent(AtomSpace "(uuid . 1)")

INFO: toShortString(indent): indent(AtomSpace "(uuid . 1)")

INFO: disposed: true

INFO: Result: null

INFO: ===== /ConceptNode.js =====

INFO: Readonly settings: {}

INFO: Writable settings: {}

INFO: isAtom: true

INFO: isNode: true

INFO: isLink: false

INFO: getName: dream

INFO: getArity: 1

INFO: toString: (ConceptNode "dream") ; [2281a00710ad9][2]

INFO: toShortString: (ConceptNode "dream")

INFO: equals(true, dream): true

INFO: equals(false, dream): false

INFO: equals(false, atomspace): false

INFO: disposed: true

INFO: Result: null

Running scheme2js: /data/user/0/com.cogroid.atomspace.tester/cache/37b2dbe5056349378922fe855d768f33.scm , /data/user/0/com.cogroid.atomspace.tester/cache/9f3a919fa1f14545b72452e92e891a8a.js

INFO: ===== /ConceptNode.scm.js =====

INFO: Readonly settings: {}

INFO: Writable settings: {}

INFO: (ConceptNode "dream") ; [2281a00710ad9][3]

INFO: Result: null


===== PseudoValue =====


isAtom: true

isNode: false

isLink: false

isType: true

disposed: true


===== AtomSpace =====


isAtom: true

isNode: false

isLink: false

isType: true

getHash: 5

toString(indent): indent(AtomSpace "(uuid . 5)")

toShortString(indent): indent(AtomSpace "(uuid . 5)")

disposed: true


===== Node =====


isAtom: true

isNode: true

isLink: false

getName: dream

getArity: 1

toString: (ConceptNode "dream") ; [2281a00710ad9][6]

toShortString: (ConceptNode "dream")

disposed: true


===== Concept Node =====


isAtom: true

isNode: true

isLink: false

getName: dream

getArity: 1

toString: (ConceptNode "dream") ; [2281a00710ad9][7]

toShortString: (ConceptNode "dream")

equals(true, dream): true

equals(false, dream): false

equals(false, atomspace): false

disposed: true


===== SchemeEval =====

duude enter init_scheme tid=1322
duude enter SchemeEval() ctor tid=1322 this=0xc14fe8fc as=0x0
duude enter init_only_once done=0
duude init_only_once gonna make immortal me=1322
duude init_only_once done make immortal me=1322
duude enter immortal tid=1323
redirect stdout & stderr to file ... done
try to write to stdout ... done

from atomspace.

 avatar commented on June 2, 2024

In this datomspace-tester.apk, I have removed harded-code and fixed error with 'https' url.

from atomspace.

linas avatar linas commented on June 2, 2024

does not crash but it run forever without any output

If you removed the *.go files from guile.zip, then recompiling those might take hours even 12 or 24 hours, depending on the speed of your phone. There will be no output until those are rebuilt.

Starting the atomspace for the first time will cause the atomspace *.scm files to be compiled into *.go files. This might take 2 or 5 or 10 minutes, depending on your phone. It would be best if the apk included those go files (It would be best if the atomspace cmake did this automatically; I will look into it. #2945)

from atomspace.

linas avatar linas commented on June 2, 2024

SchemeEvall.cc

Could you change

fh = fopen ("/storage/emulated/0/Download/datomspace-test.txt", "a+");

to

fh = fopen ("datomspace-test.txt", "a+");

(in two places). This will write a file into "the current directory", whatever that is. I think it will then be the right directory for both you and I. (This is not urgent, however. I can live without it, I think...)

from atomspace.

 avatar commented on June 2, 2024

SchemeEvall.cc

Could you change

fh = fopen ("/storage/emulated/0/Download/datomspace-test.txt", "a+");

to

fh = fopen ("datomspace-test.txt", "a+");

(in two places). This will write a file into "the current directory", whatever that is. I think it will then be the right directory for both you and I. (This is not urgent, however. I can live without it, I think...)

Can I change as following?

struct stat sb;
if (stat("/storage/emulated/0/Download", &sb) == 0 && S_ISDIR(sb.st_mode)) {
    fh = fopen ("/storage/emulated/0/Download/datomspace-test.txt", "a+");
} else {
    fh = fopen ("/storage/sdcard0/Download/datomspace-test.txt", "a+");
}

from atomspace.

linas avatar linas commented on June 2, 2024

In this datomspace-tester.apk,

I installed this, and clicked on new "test SchemeEval" button, and nothing else. I get this:

$ cat datomspace-test.txt

java.util.zip.ZipException: Central Directory Entry signature not found; was 04034B50
	at java.util.zip.ZipFile.throwZipException(ZipFile.java:427)
	at java.util.zip.ZipEntry.<init>(ZipEntry.java:360)
	at java.util.zip.ZipFile.readCentralDir(ZipFile.java:414)
	at java.util.zip.ZipFile.<init>(ZipFile.java:151)
	at java.util.zip.ZipFile.<init>(ZipFile.java:123)
	at com.cogroid.atomspace.tester.MainActivity.unzipFile(MainActivity.java:767)
	at com.cogroid.atomspace.tester.MainActivity$RunTestsRunnable.run(MainActivity.java:178)
	at android.os.Handler.handleCallback(Handler.java:808)
	at android.os.Handler.dispatchMessage(Handler.java:103)
	at android.os.Looper.loop(Looper.java:193)
	at android.app.ActivityThread.main(ActivityThread.java:5292)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:515)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:641)
	at dalvik.system.NativeStart.main(Native Method)



===== SchemeEval =====


java.lang.UnsatisfiedLinkError: Native method not found: com.cogroid.atomspace.SchemeEval.jni_init_scheme:()V
	at com.cogroid.atomspace.SchemeEval.jni_init_scheme(Native Method)
	at com.cogroid.atomspace.SchemeEval.initScheme(SchemeEval.java:46)
	at com.cogroid.atomspace.Tester.testSchemeEval(Tester.java:263)
	at com.cogroid.atomspace.tester.MainActivity$SchemeEvalRunnableBG.run(MainActivity.java:440)
	at java.lang.Thread.run(Thread.java:841)


SchemeEval.initScheme() ... done.

java.lang.UnsatisfiedLinkError: Native method not found: com.cogroid.atomspace.AtomSpace.jni_init:()J
	at com.cogroid.atomspace.AtomSpace.jni_init(Native Method)
	at com.cogroid.atomspace.AtomSpace.<init>(AtomSpace.java:35)
	at com.cogroid.atomspace.Tester.testSchemeEval(Tester.java:268)
	at com.cogroid.atomspace.tester.MainActivity$SchemeEvalRunnableBG.run(MainActivity.java:440)
	at java.lang.Thread.run(Thread.java:841)

from atomspace.

linas avatar linas commented on June 2, 2024

Can I change as following?

Yes, that will work.

from atomspace.

linas avatar linas commented on June 2, 2024

According to this page: https://www.gnu.org/software/guile/manual/html_node/Compilation.html the *.go files contain CPU-architecture-dependent code. There is a specific --target=target flag on the guild compiler to specify the target architecture. That means, when building guile, you will need to set it up correctly for cross-compilation. I'm sure you did this when compiling the c files, but I am guessing the makefiles did not set the target correctly for the .scm->.go files. (But that is a guess.)

If/when I fix #2945 this might also present cross-compilation challenges. Not sure what to do about this ...

from atomspace.

linas avatar linas commented on June 2, 2024

I'm also thinking that the __aeabi_idiv0 bug seen earlier is a side-effect of the *.go files being architecture-dependent. That is, the *.go files contain a kind of RTL (its either GNU Lightning or a derivative of that) and that RTL ("register transfer language" or "bytecode") is executed on arm7 by calling tiny little arm7 instruction stubs such as __aeabi_idiv0 ... so this again suggests the *.go files need to be recompiled form arm7.

The above is just an educated guess, though. I could be wrong.

from atomspace.

 avatar commented on June 2, 2024

I just launch a-jsb.com for running javascript in sandbox with atomspace.

from atomspace.

linas avatar linas commented on June 2, 2024

I just launch a-jsb.com for running javascript in sandbox with atomspace.

Wow. Well, that is unexpected! It looks like the execSCM call worked, but I guess that this is an x86 version, and not arm7 ? I'm still very eager to get the arm7 issues figured out and fixed.

from atomspace.

 avatar commented on June 2, 2024

I compiled datomspace-tester.apk with more logs. Following are files:

  1. datomspace-tester.apk
  2. opencog/guile/SchemeEval.cc
  3. libguile/eval.c
  4. libguile/init.c
  5. libguile/load.c
  6. libguile/threads.c
  7. libguile/vm.c
  8. Download/datomspace-guile-eval.txt
  9. Download/datomspace-guile-init.txt
  10. Download/datomspace-guile-load.txt
  11. Download/datomspace-guile-vm.txt
  12. Download/datomspace-guile.txt
  13. Download/datomspace-load.txt
  14. Download/datomspace-stderr.txt
  15. Download/datomspace-stdout.txt
  16. Download/datomspace-test.txt

I am stuck at following error:

At libguile/init.c

At scm_load_startup_files ()

scm_c_primitive_load_path ("ice-9/boot-9");
At libguile/vm.c
...
fprintf(fh_vm, "scm_call_n #26\n");
fflush(fh_vm);

    ret = vm_engines[vp->engine](thread, vp, &registers, resume);

...

    vp->resumable_prompt_cookie = prev_cookie;

fprintf(fh_vm, "scm_call_n #28\n");
fflush(fh_vm);

It repeats "scm_call_n #26", then "scm_call_n #28", then "scm_call_n #26" again several times. After that, it stopped.

from atomspace.

linas avatar linas commented on June 2, 2024

It repeats "scm_call_n #26", then

Yeah, that's going to be a hard way to debug. Poking through that stuff is like .. debugging assembly code. And anyway, I doubt that is where the bug is. Based on several of your tombstone files, the garbage collector was accessing bad memory, and so the question is "why is it doing that?" So, some background:

  • During startup, the guile subsystem tells the garbage collector about the location of the stack (so that the GC can look for pointers there).
  • Every time a new thread is created, the GC is told about the stack for that thread.
  • The GC is told whether stacks grow up or down, and the endianness of the machine, and about alignment (2,4 or 8-byte address alignment) i.e. architecture specifics.
  • Whenever guile mallocs memory, the GC is told about the location and size of that memory (the actual details are that guile calls GC_malloc() to get more memory.
  • User C/C++ code outside of guile can place pointers into RAM that guile does not know about. The user MUST tell guile about it (so that it can tell the GC about it.) The AtomSpace does not use this feature.

When the GC runs, it searches for pointers in all of the stacks and in any malloced RAM it knows about. It is not supposed to search outside of these boundaries. Yet, clearly, this is happening: in the first tombstone, it access memory about 300 bytes away from valid RAM, and in the second tombstone, only about 8K away. These offsets are tiny: both are less than 16-bits away from a valid address. I mean, out of a giant 4GB address space, it didn't access some "random" address, it access something really close by.

This less-than-16-bit mistake suggests to me that guile is using a 16-bit short for some offset. I am guessing that, due to architecture confusion, this offset is being added instead of subtracted. How could this happen? Here are my guesses:

  1. libgc is broken or miscompiled for arm7. After compiling libgc, did you run the unit tests? Did they all pass?
  2. The guile *.go files contain some kind of architecture-dependent code, for example: address-offset info, (indirect addressing), stack-growth direction, endianness ... and the *.go files are compiled for some other architecture, and not arm7. Are you building the *.go files on arm7, or are you cross-compiling?
  3. The *go files contain GNU-lighting RTL. It looks like this:
$ guild disassemble ./srfi/srfi-1.go
  44    (mov 1 7)                                             at srfi/srfi-1.scm:830:11
  45    (handle-interrupts)             
  46    (call 7 2)                      
  48    (receive 4 7 9)                 
  50    (immediate-tag=? 4 3839 4)      ;; false?             at srfi/srfi-1.scm:828:4
  52    (jne 6)                         ;; -> L3
  53    (scm-ref/immediate 5 8 1)                             at srfi/srfi-1.scm:837:17
  54    (mov 4 5)                                             at srfi/srfi-1.scm:837:11
  55    (mov 5 8)                       

The mov and jne and call are translated into arm7 pseudo-assembly: they are calls to functions such as __aeabi_movi and __aeabi_jne and whatever: these are very short subroutines in the arm7 libc.so that are just wrappers for one or two arm7 assembly instructions. It is possible that maybe this translation is incorrect.

I asked the guile gurus about about arm7 on IRC chat. They said it works fine on Android. They said "just install guix, you'll see" (guix is a guile linux distro.) So, here's how we can check this:

A. Install a terminal emulator on the phone
B. run the guile shell on the phone, from the terminal emulator. Its in /sdcard1/something/bin/guile
C. At the guile prompt, run some scheme commands:

(+ 2 2)
(display "hello world\n")
(gc)
(gc-stats)

The (gc) call forces GC to run, and (gc-stats) prints some statistics. All sizes are in bytes, times are in nanoseconds, something like that. All of this should work. If this does NOT work ... then ... let me know.

I could not do this myself, because running /sdcard1/something/bin/guile complained that it was unable to find libsomething.so and so the whole C shared library environment needs to be set up.

If the above does work, then try

(use-modules (opencog))
(Concept "foo")
(gc)
(gc-stats)

If that works, then ???

from atomspace.

linas avatar linas commented on June 2, 2024

I wrote the above before reading through your files. I'll read your files shortly.

from atomspace.

linas avatar linas commented on June 2, 2024

again several times. After that, it stopped.

Did it hang, or did it crash? If it hangs, did you look at the cpu usage? Is the CPU usage 100% or 0% -- If it's 100%, then it is probably trying to compile ice-9/boot-9 which could take minutes or hours .. or days?

If it's hung, but there is no CPU usage, then .. ugh. We'd have to use gdb. But first, please check everything I mentioned earlier.

from atomspace.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.