{"action":"created","issue":{"url":"https://api.github.com/repos/SWI-Prolog/issues/issues/40","repository_url":"https://api.github.com/repos/SWI-Prolog/issues","labels_url":"https://api.github.com/repos/SWI-Prolog/issues/issues/40/labels{/name}","comments_url":"https://api.github.com/repos/SWI-Prolog/issues/issues/40/comments","events_url":"https://api.github.com/repos/SWI-Prolog/issues/issues/40/events","html_url":"https://github.com/SWI-Prolog/issues/issues/40","id":154223220,"number":40,"title":"No permission to load source \"...lists.pl\"","user":{"login":"Wouter1","id":7699948,"avatar_url":"https://avatars.githubusercontent.com/u/7699948?v=3","gravatar_id":"","url":"https://api.github.com/users/Wouter1","html_url":"https://github.com/Wouter1","followers_url":"https://api.github.com/users/Wouter1/followers","following_url":"https://api.github.com/users/Wouter1/following{/other_user}","gists_url":"https://api.github.com/users/Wouter1/gists{/gist_id}","starred_url":"https://api.github.com/users/Wouter1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wouter1/subscriptions","organizations_url":"https://api.github.com/users/Wouter1/orgs","repos_url":"https://api.github.com/users/Wouter1/repos","events_url":"https://api.github.com/users/Wouter1/events{/privacy}","received_events_url":"https://api.github.com/users/Wouter1/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"JanWielemaker","id":3071146,"avatar_url":"https://avatars.githubusercontent.com/u/3071146?v=3","gravatar_id":"","url":"https://api.github.com/users/JanWielemaker","html_url":"https://github.com/JanWielemaker","followers_url":"https://api.github.com/users/JanWielemaker/followers","following_url":"https://api.github.com/users/JanWielemaker/following{/other_user}","gists_url":"https://api.github.com/users/JanWielemaker/gists{/gist_id}","starred_url":"https://api.github.com/users/JanWielemaker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JanWielemaker/subscriptions","organizations_url":"https://api.github.com/users/JanWielemaker/orgs","repos_url":"https://api.github.com/users/JanWielemaker/repos","events_url":"https://api.github.com/users/JanWielemaker/events{/privacy}","received_events_url":"https://api.github.com/users/JanWielemaker/received_events","type":"User","site_admin":false},"milestone":null,"comments":14,"created_at":"2016-05-11T11:42:51Z","updated_at":"2016-05-12T11:40:34Z","closed_at":"2016-05-12T11:15:11Z","body":"Compiled latest SWI 7.2.3 from sources and installed. \r\n\r\nSWI runs fine\r\n```\r\nWelcome to SWI-Prolog (Multi-threaded, 64 bits, Version 7.2.3)\r\n...\r\n```\r\n\r\nTest machine: \r\n```\r\nProcessor  2.93 GHz Intel Core i7\r\nMemory  4 GB 1333 MHz DDR3\r\nGraphics  ATI Radeon HD 5750 1024 MB\r\nSoftware  OS X 10.9.5 (13F1712)\r\n```\r\n\r\nWe checked that simple JPL tests run fine.\r\n\r\nThen we change the Zahed.java example to contain the following\r\n```\r\nimport java.util.Map;\r\n\r\nimport org.jpl7.Atom;\r\nimport org.jpl7.Compound;\r\nimport org.jpl7.Query;\r\nimport org.jpl7.Term;\r\nimport org.jpl7.Variable;\r\nimport org.jpl7.JPL;\r\n\r\nimport java.util.ArrayList;\r\nimport java.util.List;\r\nimport java.util.Map;\r\n\r\npublic class Zahed {\r\n\tprivate static final int NTHREADS = 88;\r\n\tprivate static final String SwiPath =\"/usr/lib/swipl-6.2.3/\"; \r\n\r\n\tpublic static void main(java.lang.String argv[]) throws InterruptedException {\r\n\tJPL.setDefaultInitArgs(new String[] { \"--quiet\", \"--nosignals\" });\r\n\tJPL.setDTMMode(false);\r\n\t\tnew Zahed().multiThreadTest();\r\n\t}\r\n\r\n\tpublic void multiThreadTest() throws InterruptedException {\r\n\t\tSystem.out.println(\"Multi-thread test\");\r\n\t\tList<Thread> threads = new ArrayList<Thread>();\r\n\t\tfor (int n = 0; n < NTHREADS; n++) {\r\n\t\t\tthreads.add(runThread(n));\r\n\t\t}\r\n\t\twhile (!threads.isEmpty()) {\r\n\t\t\tThread thread = threads.get(0);\r\n\t\t\t// System.out.println(\"Waiting for \" + thread);\r\n\t\t\tthread.join();\r\n\t\t\tthreads.remove(thread);\r\n\t\t}\r\n\t}\r\n\r\n\tprivate Thread runThread(final int n) {\r\n\t\tThread thread = new Thread(new Runnable() {\r\n\t\t\t@Override\r\n\t\t\tpublic void run() {\r\n\t\t\t\ttry {\r\n\t\t\t\t\ttestSimpleQueries(n);\r\n\t\t\t\t} catch (InterruptedException e) {\r\n\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t\tthread.start();\r\n\t\treturn thread;\r\n\t}\r\n\r\n\tprivate void testSimpleQueries(int n) throws InterruptedException {\r\n\t\tnew Query(\"set_prolog_flag(debug_on_error,false)\").hasSolution();\r\n\r\n\t\tString module = \"robot_\" + n;\r\n\t\tString formula = \"test :- member(3,[1,2,3,4,5])\";\r\n\t\tinsert(module, formula);\r\n\t\tMap<String, Term> res = query(module, \"test\");\r\n\r\n\t\tinsert(module, \"fibo(0,0)\");\r\n\t\tinsert(module, \"fibo(1,0)\");\r\n\t\tinsert(module,\r\n\t\t\t\t\"fibo(X,Y):-X>1, X1 is X-1, X2 is X-2, fibo(X1,Y1), fibo(X2,Y2), Y is Y1 + Y2\");\r\n\t\tquery(module, \"listing\");\r\n\r\n\t\tres = query(module, \"fibo(22,Y)\");\r\n\t}\r\n\r\n\tprivate void insert(String module, String formula) {\r\n\t\tString f = \"assert(\" + module + \":(\" + formula + \"))\";\r\n\t\t// System.out.println(f);\r\n\t\tnew Query(f).hasSolution();\r\n\t}\r\n\r\n\t@SuppressWarnings(\"unchecked\")\r\n\tprivate Map<String, Term> query(String module, String formula) {\r\n\t\tString q = module + \":\" + formula;\r\n\t\t// System.out.println(q);\r\n\t\treturn new Query(q).allSolutions()[0];\r\n\t}\r\n}\r\n```\r\n\r\nwe run it . We get many exceptions like this\r\n```\r\nERROR: Unhandled exception: load_files/2: No permission to load source `'/usr/lib/swipl-7.2.3/library/lists.pl'' (Non-module file already loaded into module robot_36; trying to load into robot_61)\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/SWI-Prolog/issues/issues/comments/218732898","html_url":"https://github.com/SWI-Prolog/issues/issues/40#issuecomment-218732898","issue_url":"https://api.github.com/repos/SWI-Prolog/issues/issues/40","id":218732898,"user":{"login":"Wouter1","id":7699948,"avatar_url":"https://avatars.githubusercontent.com/u/7699948?v=3","gravatar_id":"","url":"https://api.github.com/users/Wouter1","html_url":"https://github.com/Wouter1","followers_url":"https://api.github.com/users/Wouter1/followers","following_url":"https://api.github.com/users/Wouter1/following{/other_user}","gists_url":"https://api.github.com/users/Wouter1/gists{/gist_id}","starred_url":"https://api.github.com/users/Wouter1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wouter1/subscriptions","organizations_url":"https://api.github.com/users/Wouter1/orgs","repos_url":"https://api.github.com/users/Wouter1/repos","events_url":"https://api.github.com/users/Wouter1/events{/privacy}","received_events_url":"https://api.github.com/users/Wouter1/received_events","type":"User","site_admin":false},"created_at":"2016-05-12T11:40:34Z","updated_at":"2016-05-12T11:40:34Z","body":">Oh, forgot to mention I pushed a fix for this (SWI-Prolog/swipl-devel@b8b7c69). Will probably apply to 7.2 as well.\r\n\r\nThat's fast, I didn't expect it! \r\n\r\nI prefer to use official releases so better wait till the next stable. Do you have an idea when it will appear?"}}