Art Installation, Long Run Times


#1

Hi All,

I’m working on a project with an artist, and my contribution will be an interactive projection w/ Kinect. The sketch is in P5v3 (Java), and should be expected to run continuously for 8+ hrs. a day. The exhibition will last several weeks.

I’m wondering if there are strategies that others have adopted specific to these kinds of circumstances. I’ll test as thoroughly as I can before deployment (obviously), but if those with more experience have specific recommendations, I’d love to hear them.

Is it wise to have the sketch periodically restart at set intervals? Should this be done within the sketch, or from an external script? Anything else I should be thinking about?

Many Thanks!


#2

This isn’t the first time this has come up. Really, there should be no problems with a sketch running for a long period of time, but people tend to worry about it every now and then…

First of all, don’t worry about millis() overflowing unless your sketch is running for weeks on end.

Next, if you can have an external script restart the sketch every so often - or maybe check occasionally that it is still running and restart it if it is not, that would be best. That would be wise, but it’s not something you can do from within the sketch itself (well, not easily).

Make sure you are not loading things in draw() constantly, and that your sketch isn’t saving things a lot. Like, if you’re saving the image of every frame drawn, that might be a problem. If it does need to load data from an external source, make sure it is doing so periodically, not constantly, and won’t crash horribly if some external source can’t be reached/found. Basically, check things have loaded before accessing them.

If you are manually starting it running each day, it should be fine. I wouldn’t worry too much, but do have an external script kicking it off if you can.


#3

I have sevral Procesing projects running for 8 hours and sevral weeks without problem (almost).
One think you have to do is to make sure that your sketch can be esaly restated by a staf member , of the exibition , if it crash.
Think of a way to make it stat at bootup.
Compile your sketch and but a shortcut on the desktop
to start your project.
Write a complete protocol for openning and closing your installation.
Think to add to this protocol all informations how to restart your sketch and who to verify if all
components are well connected.
With web camera or Kinect , sometime the usb port seem to malfonction, make sure that the staf can plug the kinect in an other usb port if needed.

Good lock

[http://pascalaudet.com/projets.html](Some of my projects here)


#4

You might want to have a look at something like Tooloop. I haven’t tried it yet, and it’s still marked as alpha, but does cover some of the launching and monitoring things discussed. You could at least look at the script that monitors for the process and relaunches it if not running. And you didn’t mention an OS(?), but I’d highly recommend a dedicated Linux setup for this. I’ve had multiple Java installations (not Processing) running for years on custom Linux setups.

I’d also do some memory profiling with VisualVM or similar and keep an eye out for memory issues.


#5

Regarding overflow: there are two potential types, millisecond overflow and frame count overflow. Millisecond will never happen, frame takes over a year.

  1. millis() is backed internally by a long; it will overflow in 292,471,208 years.

    https://www.google.com/search?q=9223372036854775807+milliseconds+in+years

  1. frameCount is backed by a signed int; at 60fps it will roll over to negative in about 414 days and rerun setup every ~2.3 years.

    https://www.google.com/search?q=2147483647%2F60+seconds+in+days

    Unless your sketch is doing math with frameCount, it won’t notice going negative. After ~828 days of running, however, it will hit frame 0 again. This will skip drawing for a single frame and trigger setup() re-running. If you are planning on having your sketch run for more than two years without restarting (?) then you could design around this with a setup guard field that prevents the contents of setup from rerunning ( if(notAlreadyRun){ // do setup } ).

    For more, see: https://forum.processing.org/two/discussion/comment/87073/#Comment_87073

In short, you can leave a sketch running for 8 hours – or for a several week installation – and not worry at all about the draw loop. You may still need to be ensure that you aren’t accumulating values of other kinds that could overflow in your own code.


#6

I’ve been running installations using KinectPV2 for 8+ hours and without external peripherals for around a week.

Things which can get you:

  • computer is set to turn the display off after 30 minutes
  • computer is set to sleep after 1 hour
  • beamer has some strange power saving feature and turns off every 3 hours
  • a gross memory leak or allocating too much memory and getting OutOfMemoryException - make sure you are not accumulating large stuff, like creating a PImage every minute and adding it to an array
  • saving time in floats - always use long - above 16777216 float can represent only even numbers and above 33554432 only numbers divisible by 4, etc.; this can lead to very strange bugs especially in long running sketches
  • somebody trips over a cable or presses a button (like ‘switch input’ on a display or beamer)

Things which helped me in the past:

  • develop with a reasonably sized heap to catch memory bugs early, but run with a large heap like -Xmx1g or -Xmx2g (or more, depending on your installation and RAM size) so that there is some headroom
  • as neilcsmith already pointed out, try running your installation for longer period together with VisualVM, keep an eye on memory usage, make sure there is no unexpected accumulation of memory which can’t be garbage collected
  • as PascalAudet suggested - make your program start when the computer is turned on - in case something goes wrong, holding the power button for 10-30 seconds will usually cut the power and after restart it will work again - easy enough for an attendant or a layman to do, even without mouse and keyboard
  • write down how to turn the whole installation on and off, include your phone number
  • if you are using Windows 10, unplug the ethernet cable/wifi (or if you really need internet, set it to metered connection) to prevent automatic updates, set active hours so that it does not restart during opening hours

Hope some of this helps. Good luck! :slight_smile:


#7

I’ve been on the road this weekend… monitoring replies but deferring responding.

The assurances are amazingly encouraging, and the technical recommendations are priceless. I plan to have my collaborators read through all of this… they will be responsible for final hardware configuration.

If people have more to add, please keep the input coming!

Sincere Thanks!


#8

Hi Everyone,

Just thought I’d stop by with a followup. The installation ran through the whole month of February without any reported issues. Artist and gallery owner were both very pleased, and it was very well received by the visitors.

Extremely grateful for the community support.

Best,

RA