Testing I'm getting connection problems - any current SN issues?


#21

You are right @happybeing , that wouldn’t explain it, unless you are leaking some handle/s and not freeing it before window.location.reload()…?..

If you have the chance, can you please give it a try to the following branch which I’m expecting to fix the problem?


#22

Strange. I cloned and built but it won’t connect to SN (0.10.1 is fine though). The browser starts up but I’m getting Core error: Unexpected: Could not connect to the SAFE Network when I try to log in.

Linux 64 bit
nodejs 8.0.0

I did yarn run build && yarn run package

Trying yarn run burnthemall I’m getting some warnings (didn’t see these earlier)…

warning appdmg@0.4.5: The platform "linux" is incompatible with this module.
warning fsevents@1.1.3: The platform "linux" is incompatible with this module.
[1/2] ⢀ electron
[2/2] ⢀ fs-xattr: spawn args   '-Goutput_dir=.' ]
[-/2] ⢀ waiting...
[-/2] ⢀ waiting...
warning Error running install script for optional dependency: "/home/mrh/.cache/yarn/v1/npm-fs-xattr-0.1.17-ee943483c6fe9704a8f0e1476e8145a9886f8b0f: Command failed.\nExit code: 1\nCommand: sh\nArguments: -c node-gyp rebuild\nDirectory: /home/mrh/.cache/yarn/v1/npm-fs-xattr-0.1.17-ee943483c6fe9704a8f0e1476e8145a9886f8b0f\nOutput:\ngyp info it worked if it ends with ok\ngyp info using node-gyp@3.6.1\ngyp info using node@8.0.0 | linux | x64\ngyp info spawn /usr/bin/python2\ngyp info spawn args [ '/home/mrh/.nvm/versions/node/v8.0.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',\ngyp info spawn args   'binding.gyp',\ngyp info spawn args   '-f',\ngyp info spawn args   'make',\ngyp info spawn args   '-I',\ngyp info spawn args   '/home/mrh/.cache/yarn/v1/npm-fs-xattr-0.1.17-ee943483c6fe9704a8f0e1476e8145a9886f8b0f/build/config.gypi',\ngyp info spawn args   '-I',\ngyp info spawn args   '/home/mrh/.nvm/versions/node/v8.0.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',\ngyp info spawn args   '-I',\ngyp info spawn args   '/home/mrh/.node-gyp/8.0.0/include/node/common.gypi',\ngyp info spawn args   '-Dlibrary=shared_library',\ngyp info spawn args   '-Dvisibility=default',\ngyp info spawn args   '-Dnode_root_dir=/home/mrh/.node-gyp/8.0.0',\ngyp info spawn args   '-Dnode_gyp_dir=/home/mrh/.nvm/versions/node/v8.0.0/lib/node_modules/npm/node_modules/node-gyp',\ngyp info spawn args   '-Dnode_lib_file=node.lib',\ngyp info spawn args   '-Dmodule_root_dir=/home/mrh/.cache/yarn/v1/npm-fs-xattr-0.1.17-ee943483c6fe9704a8f0e1476e8145a9886f8b0f',\ngyp info spawn args   '-Dnode_engine=v8',\ngyp info spawn args   '--depth=.',\ngyp info spawn args   '--no-parallel',\ngyp info spawn args   '--generator-output',\ngyp info spawn args   'build',\ngyp info spawn args   '-Goutput_dir=.' ]\nmodule.js:487\n    throw err;\n    ^\n\nError: Cannot find module 'nan'\n    at Function.Module._resolveFilename (module.js:485:15)\n    at Function.Module._load (module.js:437:25)\n    at Module.require (module.js:513:17)\n    at require (internal/module.js:11:18)\n    at [eval]:1:1\n    at ContextifyScript.Script.runInThisContext (vm.js:44:33)\n    at Object.runInThisContext (vm.js:116:38)\n    at Object.<anonymous> ([eval]-wrapper:6:22)\n    at Module._compile (module.js:569:30)\n    at evalScript (bootstrap_node.js:432:27)\ngyp: Call to 'node -e \"require('nan')\"' returned exit status 1 while in binding.gyp. while trying to load binding.gyp\ngyp ERR! configure error \ngyp ERR! stack Error: `gyp` failed with exit code: 1\ngyp ERR! stack     at ChildProcess.onCpExit (/home/mrh/.nvm/versions/node/v8.0.0/lib/node_modules/npm/node_module

The build completes but still won’t connect when I try to log in.


#23

You must be just missing the crust.config file, you can copy from v0.10.1 or you can also find a copy under ./build/SAFE Browser.crust.config and you need to copy over as ./dist/safe-browser-v0.10.1-linux-x64/safe-browser.crust.config. You may want to also copy the log.toml file onto the same folder.


#24

Ah, will try that thanks. I wondered about that and looked in the package directory and it does have two .configs but I guess not the real ones.

Might be useful to add to the README.md


#25

I’ve tested your fork and it seems improved, but I’m still hitting the issue.

Previously I hit it after creating three new posts in succession, now I get to five. This includes a call to safeApp.free(appHandle) immediately before the window.location.reload(), and while my code is authorising and connecting multiple times, it should be freeing the appHandle before obtaining a new one.

So it may be a bug in my code, but also may still be an issue with the DOM API itself.

Worrryingly though, closing the tab and opening the website in a new one does not clear the problem. I’ll now try closing and waiting five minutes… still not cleared.

So closing the website’s tab is still not freeing the proxy connections, and it also looks like window.location.reload() is losing track of them. If I restart the browser all is good again.

On reflection, I’m not sure the fork is any different. I may have got to five new posts this time because I went straight to that and hadn’t done anything else since starting the browser.


#26

@happybeing I just gave it a try with the one published at safe://plumetest (I cannot create posts but just browse using the existing ones) and what I see is that the app never frees any safeApp instance, I do see it’s freeing up some other objects (perhaps MD’s related objects handles), but not a safeApp object handle. Therefore, as you keep using the app and it reloads each time then one more connection is consumed. I also tried closing the tab and I do see all safeApp handles being freed by the browser, and I can open the app again and connect successfully on a new tab.

Could it be you are not using the right handle or overwriting the app handle you use to call freeApp() ?

Now, more in detail, what’s happening is that some time ago (I think it was also due to one of your apps, not sure if this same one) we made an adjustment to the mechanism that automatically frees handles when the page is reloaded, to only do it when the new page that is being loaded contains a different public Id, since the app was changing the URL via pushstate reloading with some relative paths (some more info here). Thus your app now is reloading each time without freeing the safeApp handle and with the same public Id, therefore the automatic mechanism is not kicking in untill you either load a page with different public Id, or close the tab.

PM me if you wanna go on a hangout, if you think it can help.


#27

Thanks Gabriel, this gives me some lines of investigation, so very helpful.

Only the storage owner can create posts, which is not hard to set up for you, but it sounds like my code is probably not doing what I think so I’ll look into that.

I will probably not be able to follow up for a few days though, so expect a delay… and some peace from me at least :wink:

The code is working well enough for me to create a short demo so it’s not urgent. I’ll probably do that first. Thanks again.


#28

A quick note @bochaco. I haven’t looked further yet, but regardless it occurs to me that the behaviour I’m seeing still suggests a problem with the browser. This is because I’m still not seeing the connection recover on closing the tab and opening a new tab - so different to your test code.

I’m busy with family for a week or so now, but if you want to look into it let me know and I’ll help you get a copy of plume going which allows you to create posts. You can probably figure it out yourself of course, but I’ll write the key bits down if you plan to look at it. One thing to do is to edit the config.json and set postsURI to a new path on a public ID that does not yet exist. This will be created when first run, when you Login and accept the Auth request. So for example:

"postsURI": "safe://gabrielstorage/posts" 

But don’t host your plume on the same public ID - it will work, but the debug console output won’t be as clear.

The rest is fairly straightforward but if anything is not clear ping me and I’ll write it down.


#29

@happybeing, I was looking into this again today, I’m not able to reproduce the issue with closing the tab after browsing your blog posts. I tried to setup my own one to test it with posting blogs but wasn’t able to, I got stuck when the app is asking me for the WebId, I created and account in databox.me but don’t know exactly how to get it to use it, I tried by setting it in the config: "owners": ["https://pubwebid2.databox.me"], but still the same: safe://pubid1. Or here is another attempt: safe://pubwebid2

So can you please confirm you are reproducing the issue when browsing blog posts, then closing the tab and re-opening the app in a new tab?
…or is it only when you post new blogs and closing the tab doesn’t free the connections?


#30

I was only seeing it when creating new posts although there may be other ways of causing this.

To set up your own solid-plume on SAFE you don’t need a real WebID. You only need to modify the config.json to something like this (this one should work for example):

{
    "title": "Gabriel's Plume Blog",
    "tagline": "Creating, helping and enjoying SAFE Network",

    "picture": "safe-quill.png",
    "fadeText": true,
    "showSources": true,
    "cacheUnit": "days",
    "defaultPath": "posts",

    "owners": ["safe://gabriel/card#me"],
    "owner": {
      "name": "bochaco",
      "webid": "safe://gabriel/card#me",
      "picture": "gabriel.jpg",
      "authenticated": false
    },

    "safeAppConfig": {
      "id":     "com.bochaco.plume.poc",
      "name":   "Gabriel Plume (PoC)",
      "vendor": "com.bochaco"
    },
    "postsURL": "safe://gabrielsplume/posts/"
}

The only lines there that really needed to be changed are in safeAppConfig. The first time you authorise it will offer you to start writing posts, and when you click that it will create the publicID for your postsURL which is used for storage. Once created, create at least one post and you won’t see that again, just the posts you’ve created in your postsURL storage.

I’ve made changes in the earlier section but they aren’t important - they will just stop your blog and posts looking like mine.

I think that if you create four or five posts in succession you should trigger the connection error, but closing the tab and loading the blog into a new tab will not fix this. (Or if it does I shall have to apologise!) Closing the browser of course does fix it, but creating several new posts should trigger it again.

If that doesn’t happen, let me know and I will re-test. Thanks for looking into it! :slight_smile:


#31

I just published it at safe://gabplumetest but it doesn’t try to authorise, it tries to open this URL on my chrome browser:

https://databox.me/,proxy?uri=safe%3A%2F%2Fgabrielsplume%2Fposts%2F

and it shows this page in beaker:

BTW, I’m using the code from here: https://github.com/theWebalyst/solid-plume


#32

Looks like you need to check out the branch?


#33

Ok, I checked-out the safenetwork-poc branch now, but I’m having issues to upload it as there are some links that are not resolved in my machine, it seems I’m missing some libraries that need to be installed?

lrwxrwxrwx 1 bochaco bochaco     48 May  1 09:10 rdflib.min.js -> /home/mrh/src/solid/rdflib.js/dist/rdflib.min.js
lrwxrwxrwx 1 bochaco bochaco     52 May  1 09:10 rdflib.min.js.map -> /home/mrh/src/solid/rdflib.js/dist/rdflib.min.js.map
lrwxrwxrwx 1 bochaco bochaco     65 May  1 09:10 safenetwork-webapi.js -> /home/mrh/src/solid/safenetwork-webapi/dist/safenetwork-webapi.js
lrwxrwxrwx 1 bochaco bochaco     69 May  1 09:10 safenetwork-webapi.js.map -> /home/mrh/src/solid/safenetwork-webapi/dist/safenetwork-webapi.js.map

#34

Ah sorry, I thought git pushed the files not the links!

I’m linking to the relevant branches here so make sure to check those out:



#35

I was able to publish it and load it now.

When I load the page, before hitting “Initialise Storage”, I see the following errors in the dev console which seems you are not passing the handle/s properly to your functions:

browser.js:133 safe:web getServiceForUri(safe://gplumetest1/config.json) FAILED: Error: Invalid handle: null

This is the complete log:

safe:plume initPlume()
browser.js:133 safe:web SafenetworkWebApi.fetch(safe://gplumetest1/config.json,undefined)... +30ms
browser.js:133 safe:web SafenetworkWebApi._fetch(safe://gplumetest1/config.json,undefined) +1ms
browser.js:133 safe:web getServiceForUri(safe://gplumetest1/config.json)... +0ms
browser.js:133 safe:web URI has profile '' and publicName 'gplumetest1' +1ms
browser.js:133 safe:web getServicesMdFor(gplumetest1) +1ms
browser.js:133 safe:web host 'gplumetest1' has publicName 'gplumetest1' +0ms
browser.js:133 safe:web makeServicesMdName(gplumetest1) +0ms
browser.js:133 safe:web makeServicesMdName(gplumetest1) +11ms
browser.js:133 safe:web getServiceForUri(safe://gplumetest1/config.json) FAILED: Error: Invalid handle: null
    at /home/bochaco/work/bochaco-safe_browser/dist/safe-browser-v0.10.2-linux-x64/resources/app/node_modules/beaker-plugin-safe-app/dist/api.js:130:19
    at Promise (<anonymous>)
    at getObj (/home/bochaco/work/bochaco-safe_browser/dist/safe-browser-v0.10.2-linux-x64/resources/app/node_modules/beaker-plugin-safe-app/dist/api.js:121:10)
    at Object.module.exports.module.exports.sha3Hash (/home/bochaco/work/bochaco-safe_browser/dist/safe-browser-v0.10.2-linux-x64/resources/app/node_modules/beaker-plugin-safe-app/dist/api.js:1170:10)
    at EventEmitter.<anonymous> (/home/bochaco/work/bochaco-safe_browser/dist/safe-browser-v0.10.2-linux-x64/resources/app/node_modules/pauls-electron-rpc/lib/export-api.js:73:20)
    at emitMany (events.js:146:13)
    at EventEmitter.emit (events.js:223:7)
    at WebContents.<anonymous> (/home/bochaco/work/bochaco-safe_browser/dist/safe-browser-v0.10.2-linux-x64/resources/electron.asar/browser/api/web-contents.js:266:13)
    at emitTwo (events.js:125:13)
    at WebContents.emit (events.js:213:7) +4ms
browser.js:133 safe:web SafenetworkWebApi._fetch() - no service available, defaulting to webFetch()... +2ms
browser.js:133 safe:web SafenetworkWebApi._fetch() error: Error: Invalid handle: null
    at /home/bochaco/work/bochaco-safe_browser/dist/safe-browser-v0.10.2-linux-x64/resources/app/node_modules/beaker-plugin-safe-app/dist/api.js:130:19
    at Promise (<anonymous>)
    at getObj (/home/bochaco/work/bochaco-safe_browser/dist/safe-browser-v0.10.2-linux-x64/resources/app/node_modules/beaker-plugin-safe-app/dist/api.js:121:10)
    at Object.module.exports.module.exports.webFetch (/home/bochaco/work/bochaco-safe_browser/dist/safe-browser-v0.10.2-linux-x64/resources/app/node_modules/beaker-plugin-safe-app/dist/api.js:613:10)
    at EventEmitter.<anonymous> (/home/bochaco/work/bochaco-safe_browser/dist/safe-browser-v0.10.2-linux-x64/resources/app/node_modules/pauls-electron-rpc/lib/export-api.js:73:20)
    at emitMany (events.js:146:13)
    at EventEmitter.emit (events.js:223:7)
    at WebContents.<anonymous> (/home/bochaco/work/bochaco-safe_browser/dist/safe-browser-v0.10.2-linux-x64/resources/electron.asar/browser/api/web-contents.js:266:13)
    at emitTwo (events.js:125:13)
    at WebContents.emit (events.js:213:7) +1ms
app.js:2059 FAILED to load config from file 'safe://gplumetest1/config.json' - response: 404
app.js:2066 safe:plume jsonConfig:  Object {title: "SAFE Plume Blog (dev hardConfig)", tagline: "Safe as houses, light as a feather", picture: "safe-quill.png", fadeText: true, showSources: true…}
app.js:1947 safe:plume init()...
app.js:1833 safe:plume applyConfig()...
app.js:371 safe:plume showBlog()
browser.js:133 safe:web SafenetworkWebApi.fetch(safe://gplumetest1/posts/,Object)... +6ms
browser.js:133 safe:web SafenetworkWebApi._fetch(safe://gplumetest1/posts/,Object) +0ms
browser.js:133 safe:web getServiceForUri(safe://gplumetest1/posts/)... +1ms
app.js:404 safe:plume DEBUG URLf:  safe://gplumetest1/
browser.js:133 safe:web URI has profile '' and publicName 'gplumetest1' +0ms
browser.js:133 safe:web getServicesMdFor(gplumetest1) +1ms
browser.js:133 safe:web host 'gplumetest1' has publicName 'gplumetest1' +0ms
browser.js:133 safe:web makeServicesMdName(gplumetest1) +0ms
app.js:2074 safe:plume DEBUG initPlume() completed!
app.js:2108 safe:plume DEBUG Plume init done!
app.js:2109 Plume result:  Object {user: Object, posts: Object, notify: function, login: function, logout: function…}
app.js:2110 safe:plume DEBUG URL:  safe://gplumetest1/
browser.js:133 safe:web makeServicesMdName(gplumetest1) +10ms
browser.js:133 safe:web getServiceForUri(safe://gplumetest1/posts/) FAILED: Error: Invalid handle: null
    at /home/bochaco/work/bochaco-safe_browser/dist/safe-browser-v0.10.2-linux-x64/resources/app/node_modules/beaker-plugin-safe-app/dist/api.js:130:19
    at Promise (<anonymous>)
    at getObj (/home/bochaco/work/bochaco-safe_browser/dist/safe-browser-v0.10.2-linux-x64/resources/app/node_modules/beaker-plugin-safe-app/dist/api.js:121:10)
    at Object.module.exports.module.exports.sha3Hash (/home/bochaco/work/bochaco-safe_browser/dist/safe-browser-v0.10.2-linux-x64/resources/app/node_modules/beaker-plugin-safe-app/dist/api.js:1170:10)
    at EventEmitter.<anonymous> (/home/bochaco/work/bochaco-safe_browser/dist/safe-browser-v0.10.2-linux-x64/resources/app/node_modules/pauls-electron-rpc/lib/export-api.js:73:20)
    at emitMany (events.js:146:13)
    at EventEmitter.emit (events.js:223:7)
    at WebContents.<anonymous> (/home/bochaco/work/bochaco-safe_browser/dist/safe-browser-v0.10.2-linux-x64/resources/electron.asar/browser/api/web-contents.js:266:13)
    at emitTwo (events.js:125:13)
    at WebContents.emit (events.js:213:7) +1ms
browser.js:133 safe:web SafenetworkWebApi._fetch() - no service available, defaulting to webFetch()... +1ms
browser.js:133 safe:web SafenetworkWebApi._fetch() error: Error: Invalid handle: null
    at /home/bochaco/work/bochaco-safe_browser/dist/safe-browser-v0.10.2-linux-x64/resources/app/node_modules/beaker-plugin-safe-app/dist/api.js:130:19
    at Promise (<anonymous>)
    at getObj (/home/bochaco/work/bochaco-safe_browser/dist/safe-browser-v0.10.2-linux-x64/resources/app/node_modules/beaker-plugin-safe-app/dist/api.js:121:10)
    at Object.module.exports.module.exports.webFetch (/home/bochaco/work/bochaco-safe_browser/dist/safe-browser-v0.10.2-linux-x64/resources/app/node_modules/beaker-plugin-safe-app/dist/api.js:613:10)
    at EventEmitter.<anonymous> (/home/bochaco/work/bochaco-safe_browser/dist/safe-browser-v0.10.2-linux-x64/resources/app/node_modules/pauls-electron-rpc/lib/export-api.js:73:20)
    at emitMany (events.js:146:13)
    at EventEmitter.emit (events.js:223:7)
    at WebContents.<anonymous> (/home/bochaco/work/bochaco-safe_browser/dist/safe-browser-v0.10.2-linux-x64/resources/electron.asar/browser/api/web-contents.js:266:13)
    at emitTwo (events.js:125:13)
    at WebContents.emit (events.js:213:7) +1ms
app.js:374 HEAD response: Response
app.js:392 safe:plume DEBUG URLc:  safe://gplumetest1/
app.js:1613 safe:plume DEBUG URL resetAll() START:  safe://gplumetest1/
app.js:193 safe:plume DEBUG authorParam( ? )
app.js:194 safe:plume DEBUG - user.authenticated:  undefined
app.js:195 safe:plume DEBUG - user.webid:  undefined
app.js:1638 safe:plume DEBUG URL resetAll() DONE:  safe://gplumetest1/
app.js:394 safe:plume DEBUG URLd:  safe://gplumetest1/
app.js:396 safe:plume DEBUG URLe:  safe://gplumetest1/

Then after hitting “Initialise Storage”, I get the app authorised, and I see a SAFEApp instance is created.

But after a moment I see the page is refreshed and the app requests to get authorised again and a second SAFEApp instance is created, and the first one is not being freed, so that one is being leaked. At this point I don’t think I’m getting any errors and I get the page to create the posts.

Then I tried creating a post but it fails, I see the following errors on the dev console which seems related to incorrect permissions on an NFS container:

safe:ldp Unable to create file 'safe://gplumetest1/posts/1525171711077-test-leakage-2.ttl' : Error: Core error: Routing client error -> Access denied

This is the complete log:

safe:ldp SafeServiceLDP._getFolder('safe://gplumetest1/posts/', ...) response 200 body:
 @prefix : <#>.
@prefix ldp: <http://www.w3.org/ns/ldp#>.

<> a ldp:BasicContainer, ldp:Container.

 +1ms
solid.js:417 HEAD response: OK Response
app.js:849 plume:safe DEBUG user.name:  happybeing
app.js:850 plume:safe DEBUG user.picture:  mugshot-hb.jpg
app.js:915 safe:plume savePost(post, undefined)
solid.js:527 safe:plume PUT safe://gplumetest1/posts/1525170216699-test-leakage-1.ttl
browser.js:133 safe:web SafenetworkWebApi.fetch(safe://gplumetest1/posts/1525170216699-test-leakage-1.ttl,Object)... +39s
browser.js:133 safe:web SafenetworkWebApi._fetch(safe://gplumetest1/posts/1525170216699-test-leakage-1.ttl,Object) +1ms
browser.js:133 safe:web getServiceForUri(safe://gplumetest1/posts/1525170216699-test-leakage-1.ttl)... +2ms
browser.js:133 safe:ldp SafeServiceLDP.put(safe://gplumetest1/posts/1525170216699-test-leakage-1.ttl,Object) +39s
browser.js:133 safe:ldp SafeServiceLDP._getFileInfo(/posts/1525170216699-test-leakage-1.ttl) +2ms
browser.js:133 safe:ldp storageNfs() +111ms
browser.js:133 safe:ldp _getFileInfo(/posts/1525170216699-test-leakage-1.ttl) file does not exist, no fileInfo available  +103ms
browser.js:133 safe:ldp SafeServiceLDP._createFile('safe://gplumetest1/posts/1525170216699-test-leakage-1.ttl',@prefix n: <http://rdfs.org/sioc/ns#>.
@prefix terms: <http://purl.org/dc/terms/>.
@prefix XML: <http://www.w3.org/2001/XMLSchema#>.
@prefix n0: <safe://gplumetest1/posts/1525170216699-test-leakage-1.ttl#>.
@prefix c: <safe://gplumetest1/card#>.
@prefix n1: <http://xmlns.com/foaf/0.1/>.

<safe://gplumetest1/posts/1525170216699-test-leakage-1.ttl>
    a n:Post;
    terms:created "2018-05-01T10:23:36+00:00"^^XML:dateTime;
    terms:modified "2018-05-01T10:23:36+00:00"^^XML:dateTime;
    terms:title "test leakage 1";
    n:content "test leakage 1 text";
    n:has_creator n0:author.
n0:author
    a n:UserAccount;
    n:account_of c:me;
    n:avatar <safe://gplumetest1/mugshot-hb.jpg>;
    n1:name "happybeing".
,undefined,Object) +0ms
browser.js:133 safe:ldp DEBUG:  window.safeNfs.create()... +1ms
browser.js:133 safe:ldp DEBUG:  window.safeNfs.insert(nfsHandle,fileHandle,posts/1525170216699-test-leakage-1.ttl)... +197ms
browser.js:133 safe:ldp Unable to create file 'safe://gplumetest1/posts/1525170216699-test-leakage-1.ttl' : Error: Core error: Routing client error -> Access denied
    at module.exports (/home/bochaco/work/bochaco-safe_browser/dist/safe-browser-v0.10.2-linux-x64/resources/app/node_modules/@maidsafe/safe-node-app/src/native/_error.js:19:10)
    at args.push.ffi.Callback.restArgs (/home/bochaco/work/bochaco-safe_browser/dist/safe-browser-v0.10.2-linux-x64/resources/app/node_modules/@maidsafe/safe-node-app/src/native/_base.js:92:27)
    at /home/bochaco/work/bochaco-safe_browser/dist/safe-browser-v0.10.2-linux-x64/resources/app/node_modules/ffi/lib/callback.js:66:25 +195ms
browser.js:133 safe:ldp SafeServiceLDP.put putDone(status: 500) for path: safe://gplumetest1/posts/1525170216699-test-leakage-1.ttl +2ms
browser.js:133 safe:ldp putDone() failed: Error: PUT failed with status 500 (500 Internal Server Error (-100: Core error: Routing client error -> Access denied)) +1ms
browser.js:133 safe:web SafenetworkWebApi._fetch() error: Error: PUT failed with status 500 (500 Internal Server Error (-100: Core error: Routing client error -> Access denied))
    at putDone (safe://gplumetest1/js/safenetwork-webapi.js:50029:17)
    at SafeServiceLDP.put (safe://gplumetest1/js/safenetwork-webapi.js:50046:16)
    at <anonymous> +613ms
browser.js:133 safe:web SafenetworkWebApi._fetch() - no service available, defaulting to webFetch()... +1ms
browser.js:133 safe:web SafenetworkWebApi._fetch() error: Error: NFS error: File not found
    at module.exports (/home/bochaco/work/bochaco-safe_browser/dist/safe-browser-v0.10.2-linux-x64/resources/app/node_modules/@maidsafe/safe-node-app/src/native/_error.js:19:10)
    at args.push.ffi.Callback.restArgs (/home/bochaco/work/bochaco-safe_browser/dist/safe-browser-v0.10.2-linux-x64/resources/app/node_modules/@maidsafe/safe-node-app/src/native/_base.js:92:27)
    at /home/bochaco/work/bochaco-safe_browser/dist/safe-browser-v0.10.2-linux-x64/resources/app/node_modules/ffi/lib/callback.js:66:25 +578ms
solid.js:534 PUT response: 404 Not Found Response
app.js:962 Could not create post!
app.js:963 TypeError: Cannot read property 'url' of undefined
    at app.js:953
    at <anonymous>
app.js:1613 safe:plume DEBUG URL resetAll() START:  safe://gplumetest1/?author=safe%3A%2F%2Fgplumetest1%2Fcard%23me#
app.js:193 safe:plume DEBUG authorParam( ? )
app.js:194 safe:plume DEBUG - user.authenticated:  true
app.js:195 safe:plume DEBUG - user.webid:  safe://gplumetest1/card#me
app.js:1638 safe:plume DEBUG URL resetAll() DONE:  safe://gplumetest1/?author=safe%3A%2F%2Fgplumetest1%2Fcard%23me

I don’t know if it’s related to the fact that happybeing seems to be set as the user, which seems to be hard-coded somewhere as I don’t see that in the config.json

I tried closing the tab at that point, and the only 2 SAFEApp instances that were created are freed automatically, in fact I was able to tried this flow 4+ times and none of them gave me the error about network connection but the problems I just described.

How do I get it to allow me to create posts?


Webapp quick start tutorial,Cannot read property 'initialise' of undefined
#36

OK, thanks Gabriel, I’m guessing there’s a difference between your version and mine although I thought I’d pushed all changes (except one commit I was doing some further debugging with).

I’m about to start moving my boat so it will be a few hours before I can take a look. Suffice to say those errors are not present for me so all you can do I think is make sure your uploaded code for Plume app.js and Web API safenetwork-webapi.js matches the latest commit in the branches I linked to, no better…

You could also compare with the ones at safe://plumetest/js and /app by downloading each JS file via its url in the browser.

Actually you could just download the files from that location and upload them to your test for now!

I suspect you are not running that version of the code for whatever reason.

EDIT:

I don’t know if it’s related to the fact that happybeing seems to be set as the user, which seems to be hard-coded somewhere as I don’t see that in the config.json

No, this should not affect anything I can think of. Its a bug if its hard coded, but that might also be because you are running out of date code. But even that should not cause any of this. It looks like old buggy code full stop! :slight_smile:

Got to go, back in a few hours!


#37

Ok, I had the wrong branch for the safenetwork api as you suggested, so after updating those two files with your latest commit on wip branch I got it running properly: safe://gplumetest1

I was able to then initialise it with my account, it was now showing bochaco as username so it seems it was fixed, and I was also able to create 2 posts before I ran out of connections. I see that for any operation the app is refreshing the page, requesting authorisation again, and also leaking one SAFEApp instance, each time, even that I do also see that there is a second instance created each time but it’s effectively freed. So when creating a post, and then going back to the home page to create another post, I already used all the connections.

Then I closed the tab and I can see all leaked apps instances being automatically freed by the browser.

Then I open the app again, and was able to login, and create a third post. Closed the tab and open a new one and was able to login but this time I couldn’t create a post because I was getting another error:

safe:web SafenetworkWebApi._fetch() error: Error: NFS error: File not found
    at module.exports (/home/bochaco/work/bochaco-safe_browser/dist/safe-browser-v0.10.2-linux-x64/resources/app/node_modules/@maidsafe/safe-node-app/src/native/_error.js:19:10)
    at args.push.ffi.Callback.restArgs (/home/bochaco/work/bochaco-safe_browser/dist/safe-browser-v0.10.2-linux-x64/resources/app/node_modules/@maidsafe/safe-node-app/src/native/_base.js:92:27)
    at /home/bochaco/work/bochaco-safe_browser/dist/safe-browser-v0.10.2-linux-x64/resources/app/node_modules/ffi/lib/callback.js:66:25 +6s
solid.js:534 PUT response: 404 Not Found Response
app.js:962 Could not create post!
app.js:963 TypeError: Cannot read property 'url' of undefined
    at app.js:953
    at <anonymous>
app.js:1613 safe:plume DEBUG URL resetAll() START:  safe://gplumetest1/?author=safe%3A%2F%2Fgabriel%2Fcard%23me#
app.js:193 safe:plume DEBUG authorParam( ? )
app.js:194 safe:plume DEBUG - user.authenticated:  true
app.js:195 safe:plume DEBUG - user.webid:  safe://gabriel/card#me
app.js:1638 safe:plume DEBUG URL resetAll() DONE:  safe://gplumetest1/?author=safe%3A%2F%2Fgabriel%2Fcard%23me

Which seems to be something else, it seems a bug in the logic but not fully sure. I tried closing and opening again but I keep getting that NFS error when I try to create a 5th post.

So, to sum up, even that I see some other issue there which doesn’t allow me to create more posts, I see that all handles are freed every time I close the tab.

These are the versions I’m using:

bochaco@safething:~/work/solid-plume$ git log
commit 5a1a836a1bdf70a409d753e20cb0592318d0a4cc
Author: theWebalyst <github@happybeing.com>
Date:   Tue Apr 24 16:58:01 2018 +0100

    fix typos

--------------------------------------------------------
bochaco@safething:~/work/safenetwork-webapi$ git log
commit 4ca196b69c8591bb4a7c210e93308500935c0dee
Author: theWebalyst <github@happybeing.com>
Date:   Tue Apr 24 17:01:29 2018 +0100

    update usage for rdflib.js

--------------------------------------------------------
bochaco@safething:~/work/rdflib.js$ git log
commit e688009e954d538d5ffb7fdda03226a8e705f717
Author: theWebalyst <github@happybeing.com>
Date:   Wed Mar 14 12:36:52 2018 +0000

    Delete Safenetwork interface code

#38

Glad you made some progress. I’m still concerned that you might not have the right code, although it is possible that the earlier code has messed something up so you could try changing the public ID set in your config.json postsURL setting. It will then create a new public id and store.

Let me know if you try that. When I get time I’ll compare the files I have at plumetest with what you have at gplumetedt1

I’ll also check on the appHandle freeing - it’s made me think my unpushed commit may well be needed, so I’ll check that too and get back to you.

Thanks for your perseverence :slight_smile:


#39

I just tried again by publishing it on safe://gplumetest2 and setting "postsURL": "safe://gabrielsplume2/posts/", this time the issue I had with NFS error and not being able to create more posts seems to be gone. So I was able to create 10 posts by closing and opening the app again in a new tab 4 times.

So the handles are being freed up correctly when the tab is closed.

If you happen to be able to reproduce the issue again, please make sure you publish the code you have and I could try on my side, but with the code you shared in your repos everything works as expected for me, both for browsing posts or creating posts.


#40

OK, I will retest. Which browser and version did you use?