Qirky / Troop

Real-time Live Coding collaboration app
306 stars 37 forks source link

Crushing when collaborating with multiplayers #23

Open KonVas opened 5 years ago

KonVas commented 5 years ago

It seems that there are lots of crushes when trying to run with two computers. It works for a little bit when restarting concurrently but then again it crushes on one of the machines or on both of them making impossible to edit or run new lines.

Qirky commented 5 years ago

Hi there, I'll need a bit more information in order to try and help. What operating system were you using (Linux, Windows, Mac) and what live coding language you were using (FoxDot, Tidal, something else)? Do you get any error message in your command line program? Is there anything that you are doing when the program crashes or does it happen randomly? Thanks

KonVas commented 5 years ago

Hello, sorry I missed some crucial information I was during trying get my head around it at the same time. We both trying to run TidalCycles (no-stack) but also tested Stack with same problems. The issue seems to be caused by random factors thus I can't really point anything specifically. However I noticed that it will mostly hung once there is a typo, but still this is arbitrary it will also happen in normal execution from time to time, right now we are using it on Mojave vs. Sierra MacOS shifting between them the server and client assignments. I also tried to use a separate Mac computer to host the server only but same problems. Also, there is no error message to point on during the crashes. hope that makes some sense cause we really like the system and we got some very interesting results as long as it worked thus we looking forward to have it run properly for a gig.

Qirky commented 5 years ago

Unfortunately I have no access to any Mac OS so I'm unable to test, but if it's ok with you I'm going to ask you to do a few things. Are you running the executable file or the python file i.e. python run-client.py? Can you try using FoxDot with Troop and see if the crash also happens? What is the "typo" that also seems to affect it? Are you using any special/international characters? If you could screenshot it next time it happens and post it here that would be really helpful, thanks

KonVas commented 5 years ago

Okay I am about to do so. One thing, I am using a WiFi connection hope this is not a problem. Trying this python3 run-client.py the other is not working for me.

KonVas commented 5 years ago

So I think I found the reason of the problem. I was running the files.py with python3 command instead hunting a little bit in other issues in this repo turns out that it needs to be run with python (2.7.3) at max. Now seems okay, I wonder if there is any syntax highliting capabilities in Troop and if the other atrributes of the interface are working okay in MacOS for example, how to log the performance.

Qirky commented 5 years ago

Hmm that's still very strange, it should work for both Python 2 and 3, but I'm glad it is working. Not sure if I will implement syntax highlighting as it is quite complicated when using different colours for different users. Let me know if anything else happens!

KonVas commented 5 years ago

I am currently running Troop on Python 2.7.15 :: Anaconda, Inc. shall I try to make it work with 3 then? Is that the preferable version?

Qirky commented 5 years ago

If you can find the issue that would be really useful. Ideally it should be compatible with Python 2 and 3 - especially with Python 2 becoming unsupported soon

KonVas commented 5 years ago

Okay, for now running on Python 2.7.3 I can see this `

:20:11: error: Variable not in scope: streamAll :: Stream -> t tidal> tidal>` but it seems it can be safely ignored.
KonVas commented 5 years ago

Moment of distraction: screenshot of crush at this link: https://www.dropbox.com/s/rahbf9x5tv5pwx4/Screenshot%202019-03-13%2018.43.30.png?dl=0

You can actually rerproduce it, I executed twice after restarting the client two identical lines of code at the same time (see screenshot first and second lines).

Qirky commented 5 years ago

I am unable to replicate on Windows which makes me think it is specific to Mac OS. I run these two lines of code:

d1 $ jux' [id, rev, fast 2] $ sound "bd cp sn:2 mt*2" # pan saw
d1 $ jux' [id, rev, fast 2] $ sound "bd cp sn:2 mt*2" # pan saw

which gives me this error:

<interactive>:105:31: error:
    * Couldn't match expected type `Pattern ControlMap
                                    -> Pattern ControlMap'
                  with actual type `Pattern ControlMap'
    * The first argument of ($) takes one argument,
      but its type `Pattern ControlMap' has none
      In the second argument of `($)', namely
        `sound "bd cp sn:2 mt*2" # pan saw d1
           $ jux' [id, rev, fast 2] $ sound "bd cp sn:2 mt*2" # pan saw'
      In the second argument of `($)', namely
        `jux' [id, rev, fast 2]
           $ sound "bd cp sn:2 mt*2" # pan saw d1
               $ jux' [id, rev, fast 2] $ sound "bd cp sn:2 mt*2" # pan saw'

<interactive>:105:57: error:
    * Couldn't match expected type `(ControlPattern -> IO ())
                                    -> Pattern ControlMap'
                  with actual type `Pattern ControlMap'
    * The function `pan' is applied to two arguments,
      but its type `Pattern Double -> Pattern ControlMap' has only one
      In the second argument of `(#)', namely `pan saw d1'
      In the expression: sound "bd cp sn:2 mt*2" # pan saw d1

But I can run the lines individually when separated by a blank line. Are you clicking on the console when the error comes up? If so, have you tried clicking back in the main text box?

KonVas commented 5 years ago

Are you clicking on the console when the error comes up? If so, have you tried clicking back in the main text box?

It literally freezes, allowing no interaction, clicking, editing and whatnot. So I don't know how much more information I can give from it since it doesn't do anything after hanging. Terminal seems to be pretty agnostic of it providing no feedback at all.

Qirky commented 5 years ago

Hmm, ok. So just to confirm the order of things:

Does it only happen after you get an error in Tidal? Could you try causing a syntax error then running another line of code? I have a suspicion it might be to do with how Mac OS handles the stderr output of processes but unfortunately I'm unable to test this

KonVas commented 5 years ago

Hi I made a video to show exactly the flow of the issue. See at this link: https://www.dropbox.com/s/79wyum54m8oi8td/TroopCrash.mov?dl=0 interesting is that the first time it didn't crash as you may see, but second time. Also, it seems that it will crash the second time I am executing the same syntax error.

KonVas commented 5 years ago

Also please take a look on this screenshot from console, most of the times it will crush after this error shows up. https://www.dropbox.com/s/mn3baduu3o8lh3j/Screenshot%202019-03-14%2018.26.33.png?dl=0

BTW, the keystrokes, for example, kill all sound, are working even when the client is not responding.

^CKonstantinoss-MacBook-Air:Troop konstantinos$ python3 run-client.py Exception in Tkinter callback Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py", line 1705, in __call__ return self.func(*args) File "/Users/konstantinos/Dev/Troop/Troop/src/interface/interface.py", line 1381, in set_interpreter self.lang=langtypes[name]() TypeError: __init__() missing 1 required positional argument: 'args' Exception in Tkinter callback Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py", line 1705, in __call__ return self.func(*args) File "/Users/konstantinos/Dev/Troop/Troop/src/interface/interface.py", line 1381, in set_interpreter self.lang=langtypes[name]() TypeError: __init__() missing 1 required positional argument: 'args' Exception in Tkinter callback Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py", line 1705, in __call__ return self.func(*args) File "/Users/konstantinos/Dev/Troop/Troop/src/interface/interface.py", line 1381, in set_interpreter self.lang=langtypes[name]() TypeError: __init__() missing 1 required positional argument: 'args' ^CException in Tkinter callback Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py", line 1705, in __call__ return self.func(*args) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py", line 749, in callit func(*args) File "/Users/konstantinos/Dev/Troop/Troop/src/interface/line_numbers.py", line 52, in redraw fill="#d3d3d3") File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py", line 2502, in create_text def create_text(self, *args, **kw): KeyboardInterrupt Hope that's more helpful now.

Qirky commented 5 years ago

The first error there is a good catch actually - how are you selecting tidal cycles mode? Are you starting with the user interface and selecting TidalCycles, or starting with -m tidalcycles, or starting with default and going to Code -> Select Language -> TidalCycles?

I can't seem to replicate the error. Can you try evaluating the two lines, forcing the error, then evaluate code with no errors and see what happens? Thanks

EDIT: Also, the invalid character '\SO' is weird - apparently it means shift-out and is apparently used to move between fonts / character sets? Honestly no idea there but could be trouble with parsing data to/from Tidal?

KonVas commented 5 years ago

how are you selecting tidal cycles mode? Are you starting with the user interface and selecting TidalCycles, or starting with -m tidalcycles, or starting with default and going to Code -> Select Language -> TidalCycles?

Passing it in the command line won't work for me, thus I select it from the GUI. No other flag will work for me in MacOS including IP language etc. Is this relevant?

Qirky commented 5 years ago

I've updated Troop to behave properly with command line arguments but if you are inputting them from the login screen then it shouldn't make a difference. It does seem that you are going to Code -> Select language which was throwing an error and is now fixed. Could you try updating and try and get the errors again?

Does this only happen with Python 3? Do you get errors using Python 2 also?

KonVas commented 5 years ago

It behaves really erratic on python3, I am afraid it's not even error caused. As sometimes I start the client and hungs immediately. Now I am trying on python 2.7.3 and works flawlessly. As you said it would be nice to find out what is broken on 3 as 2 will might be deprecated at some point. Thanks for the fix, it looks okay now.

Qirky commented 5 years ago

Shot in the dark - can you use the most recent version by updating with git pull -a or downloading and try again? Python 3.7 changed a default value from False to True for starting processes and I just wonder if that is affecting it because it works fine for me when set to False.

KonVas commented 5 years ago

Same problems am afraid. Now it even refuses to connect to the server if I run the run-client.py with python3.

Qirky commented 5 years ago

Reverted the change so should be able to connect ok now. Can you try causing the error once, then run code with no syntax errors and then try causing the error again? I have suspicions about what is causing the issue but I just have no means to test this myself at the moment I'm afraid