jvilk / doppio-demo

Demo of the Doppio Runtime System.
MIT License
4 stars 4 forks source link

File uploads fail silently #18

Open slowkow opened 7 years ago

slowkow commented 7 years ago

I'm trying to upload this jar file at your demo page.

There's no indication if the file has successfully uploaded, or if it has failed. I just waited a bit and then tried:

java -jar picard.jar

But the file is not available, so it doesn't work. I wonder if there's a way to check if the upload is working?


I can run some of the available jars (this is neat!):

/ $ java -jar programs/clojure-1.7.0.jar
Clojure 1.7.0
user=> (let [a "AAA"] (println a))
AAA
nil

The jython jar throws some errors:

/ $ java -jar /programs/jython-standalone-2.7.0.jar                             
Exception in thread "main" java.lang.reflect.InvocationTargetException          
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)          
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:62)                                                                        
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)                                                                
        at java.lang.reflect.Method.invoke(Method.java:498)                     
        at doppio.JarLauncher.main(JarLauncher.java:34)                         
Caused by: java.lang.Error: doppio is not a supported OS platform.              
        at java.lang.UNIXProcess$Platform.get(UNIXProcess.java:164)             
        at java.lang.UNIXProcess.<clinit>(UNIXProcess.java:168)                 
        at java.lang.ProcessImpl.start(ProcessImpl.java:130)                    
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)             
        at java.lang.Runtime.exec(Runtime.java:620)                             
        at java.lang.Runtime.exec(Runtime.java:485)                             
        at org.python.jline.internal.TerminalLineSettings.exec(TerminalLineSetti
ngs.java:196)                                                                   
        at org.python.jline.internal.TerminalLineSettings.exec(TerminalLineSetti
ngs.java:186)                                                                   
        at org.python.jline.internal.TerminalLineSettings.stty(TerminalLineSetti
 ...         
jvilk commented 7 years ago

Regarding Jython... There's an odd bug in Doppio or a particular version of JLine that messes things up, preventing Jython and some other REPLs from working. I've looked through the JLine code and have no idea why it determines Doppio to be Unix; it tries to fork a process, which fails. You can still use Jython to run scripts from files in the file system and to evaluate strings on the command line, which is why it is included in the demo.

As for picard.jar, you should see the following in the terminal when you upload it with the button:

Uploading 1 files...                                                            
[1/1]: File picard.jar successfully saved. 

Are you trying to upload it to a read-only directory? You should upload it to /home. Apparently the upload fails silently in read-only directories! :(

slowkow commented 7 years ago

Oh weird, I tried it again today and it worked!

doppiojvm__a_jvm_in_javascript
slowkow commented 7 years ago

Regarding the shell, I have some very naive questions:

  1. Is the file being uploaded anywhere to your server? Or is it being "uploaded" to my web browser somewhere in local storage?

  2. Does the shell have access to remote URLs?

This is really cool work, and I'm wondering if I can use Doppio to build a standalone client-side single page web app that makes use of picard.jar to do some work. The user would just be clicking buttons, not running commands. Is this a feasible direction to go with Doppio?

jvilk commented 7 years ago
  1. There is no server. It is being uploaded to web browser-local storage (IndexedDB). You can also mount Dropbox as a file system, and upload it to Dropbox.

  2. If you mean "can Java code running in Doppio open network connections", then the answer is "kindof". Doppio implements TCP sockets by tunneling them over WebSockets, so you need a server-side component (Websockify) that converts the WebSocket connection back into a TCP connection. Right now, TCP sockets are a bit broken, and I've made some progress on fixing them, but haven't had time to finish fixing them due to other PhD-related obligations.

If picard doesn't need network connections to work, then what you are describing seems feasible. You'd have to obey threading conventions -- e.g. don't try to run multiple functions concurrently on the same emulated JVM thread.

jvilk commented 7 years ago

btw, there are many different possible file system configurations. Doppio uses my BrowserFS library. It can store data in localStorage, IndexedDB, and Dropbox. It can mount ZIP files and ISO files read-only as file systems. Someone is currently working on a Google Drive backend, too.

https://github.com/jvilk/browserfs