Synapse 0.20.0 was released a few hours ago – this is a major new release with loads of stability and performance fixes and some new features too. The main headlines are:
Support for using phone numbers as 3rd party identifiers as well as email addresses! This is huge: letting you discover other users on Matrix based on whether they’ve linked their phone number to their matrix account, and letting you log in using your phone number as your identifier if you so desire. Users of systems like WhatsApp should find this both familiar and useful ;)
Fixes some very nasty failure modes where the state of a room could be reset if a homeserver received an event it couldn’t verify. Folks who have suffered rooms suddenly losing their name/icon/topic should particularly upgrade – this won’t fix the rooms retrospectively (your server will need to rejoin the room), but it should fix the problem going forwards.
Improves the retry schedule over federation significantly – previously there were scenarios where synapse could try to retry aggressively on servers which were offline. This fixes that.
Significant performance improvements to /publicRooms, /sync, and other endpoints.
Today is a special day, the sort of day where you take a big step towards an ultimate dream. Starting Matrix and seeing it gaining momentum is already huge for us, a once in a lifetime opportunity. But one of the crazier things which drove us to create Matrix is the dream of creating cyberspace; the legendary promised land of the internet.
Whether it’s the Matrix of Neuromancer, the Metaverse of Snow Crash or the Other Plane of True Names, an immersive 3D environment where people can meet from around the world to communicate, create and share is the ultimate expression of the Internet’s potential as a way to connect: the idea of an open, neutral, decentralised virtual reality within the ‘net.
This is essentially the software developer equivalent of lying on your back at night, looking up at the stars, and wondering if you’ll ever fly among them… and Matrix is not alone in dreaming of this! There have been many walled-garden virtual worlds over the years – Second Life, Habbo Hotel, all of the MMORPGs, Project Sansar etc. And there have been decentralised worlds which lack the graphics but share the vision – whether it’s FidoNet, Usenet, IRC servers, XMPP, the blogosphere or Matrix as it’s used today. And there are a few ambitious projects like Croquet/OpenCobalt, Open Simulator, JanusVR or High Fidelity which aim for a decentralised cyberspace, albeit without defining an open standard.
But despite all this activity, where is the open cyberspace? Where is the universal fabric which could weave these worlds together? Where is the VR equivalent of The Web itself? Where is the neutral communication layer that could connect the galaxies of different apps and users into a coherent reality? How do you bridge between today’s traditional web apps and their VR equivalents?
Aside from cultural ones, we believe there are three missing ingredients which have been technically holding back the development of an open cyberspace so far:
Client software support (i.e. apps)
A universal real-time data layer to store the space
Nowadays the hardware problem is effectively solved: the HTC Vive, Oculus Rift and even Google Cardboard have brought VR displays to the general public. Meanwhile, accelerometers and head-tracking turn normal screens into displays for immersive content without even needing goggles, giving everyone a window into a virtual world.
Client software is a more interesting story: If there are many custom and proprietary VR apps that already exist out there, almost none of them can connect to other servers than the ones ran by their own vendors, or even other services and apps. An open neutral cyberspace is just like the web: it needs the equivalent of web browsers, i.e. ubiquitous client apps which can connect to any servers and services written by any vendors and hosted by any providers, communicating together via an open common language. And while web browsers of course exist, until very recently there was no way to link them into VR hardware.
This has changed with the creation of WebVR by Mozilla – defining an API to let browsers render VR content, gracefully degrading across hardware and platforms such that you get the best possible experience all the way from a top-end gaming PC + Vive, down to tapping on a link on a simple smartphone. WebVR is a genuine revolution: suddenly every webapp on the planet can create a virtual world! And frameworks like A-Frame, aframe-react and React VR make it incredibly easy and fun to do.
So looking back at our list, the final missing piece is nothing less than a backbone: some kind of data layer to link these apps together. Right now, all the WebVR apps out there are little islands – each its own isolated walled garden and there is no standard way to provide shared experiences. There is no standard way for users to communicate between these worlds (or between the VR and non-VR web) – be that by messaging, VoIP, Video or even VR interactions. There is no standard way to define an avatar, its location and movement within a world, or how it might travel between worlds. And finally, there is no standard way to describe the world’s state in general: each webapp is free to manage its scene and its content any way it likes; there is nowhere to expose the realtime scene-graph of the world such that other avatars, bots, apps, services etc. can interact with it. The same way there is no standard way to exchange messages or reuse a user profile between messaging apps today: if the cyberspace is taking shape as we speak, it is definitely not taking the path of openness. At least not yet.
Predictably enough, it’s this last point of the ‘missing data layer for cyberspace’ which we’ve been thinking about with Matrix: an open, neutral, decentralised meta-network powering or connecting these worlds. To start with, we’ve made Matrix available as a generic communications layer for VR, taking WebVR (via A-Frame) and combining it with matrix-js-sdk, as an open, secure and decentralised way to place voip calls, video calls and instant messaging both within and between WebVR apps and the rest of the existing Matrix ecosystem (e.g. apps like Riot).
a virtual lobby, providing a 1:1 WebRTC video call via Matrix through to a ‘guide’ user of your choice anywhere else in Matrix (VR or not). From the lobby you can jump into two other apps:
a video conference, calling between all the participants of a given Matrix room in VR (no interop yet with other Matrix apps)
a ‘virtual tourism’ example, featuring a 1:1 WebRTC video call with a guide, superimposed over the top of the user going skiing through 360 degree video footage.
Video calling requires a WebRTC-capable browser (Chrome or Firefox). Unfortunately no iOS browsers support it yet. If you have dedicated VR hardware (Vive or Rift), you’ll have to configure your browser appropriately to use the demo – see https://webvr.rocks for the latest details.
Needless to say, the demo’s open sourced under the Apache License like all things Matrix – you can check out the code from https://github.com/matrix-org/matrix-vr-demo. Huge kudos to Richard Lewis, Rob Swain and Ben Lewis for building this out – and to Aidan Taub and Tom Elliott for providing the 360 degree video footage!
The demo is quite high-bandwidth and hardware intensive, so here’s a video of it in action, just in case:
Now, it’s important to understand that here we’re using Matrix as a standard communications API for VR, but we’re not using Matrix to store any VR world data (yet). The demo uses plain A-Frame via aframe-react to render its world: we are not providing an API which exposes the world itself onto the network for folks to interact with and extend. This is because Matrix is currently optimised for storing and synchronising two types of data structure: decentralised timelines of conversation data, and arbitrary decentralised key-value data (e.g. room names, membership, topics).
However, the job of storing arbitrary world data requires storing and flexibly querying it as an object graph of some kind – e.g. as a scene graph hierarchy. Doing this efficiently whilst supporting Matrix’s decentralised eventual consistency model is tantamount to evolving Matrix into being a generic decentralised object-graph database (whilst upholding the constraints of that virtual world). This is tractable, but it’s a bunch more work than just supporting the eventually-consistent timeline & key-value store we have today. It’s something we’re thinking about though. :)
Also, Matrix is currently not super low-latency – on a typical busy Synapse deployment event transmission between clients has a latency of 50-200ms (ignoring network). This is fine for instant messaging and setting up VoIP calls etc, but useless for publishing the realtime state of a virtual world: having to wait 200ms to be told that something happened in an interactive virtual world would be a terrible experience. However, there are various fixes we can do here: Matrix itself is getting faster; Dendrite is expected to be one or two orders of magnitude faster than Synapse. We could also use Matrix simply as a signalling layer in order to negotiate a lower latency realtime protocol to describe world data updates (much as we use Matrix as a signalling layer for setting up RTP streams for VoIP calls or MIDI sessions).
Finally, you need somewhere to store the world assets themselves (textures, sounds, Collada or GLTF assets, etc). This is no different to using attachments in Matrix today – this could be as plain HTTP, or via the Matrix decentralised content store (mxc:// URLs), or via something like IPFS.
This said, it’s only a matter of time before someone starts storing world data itself in Matrix. We have more work to do before it’s a tight fit, but this has always been one of the long-term goals of the project and we’re going to do everything we can to support it well.
So: this is the future we’re thinking of. Obviously work on today’s Matrix servers, clients, spec & bridges is our focus and priority right now and we lots of work left there – but the longer term plan is critical too. Communication in VR is pretty much a blank canvas right now, and Matrix can be the connecting fabric for it – which is unbelievably exciting. Right now our demo is just a PoC – we’d encourage all devs reading this to have a think about how to extend it, and how we all can build together the new frontier of cyberspace!
Finally, if you’re interested in chatting more about VR on Matrix, come hang out over at #vr:matrix.org!
We are very happy to again be one of the organisations selected for Google Summer of Code (GSoC)!
Last year we had two students working on Matrix-projects over the summer – you can read the retrospective here – and now we are again offering students to work on Matrix as part of GSoC! Currently we are in the stage where students can propose interesting project ideas to any of the open source organisations picked by Google. Of course, we encourage students to get in touch with us and discuss their ideas before writing their application – please come say hi in the #gsoc:matrix.org room!
We are very eager to see what ideas students come up with. We have added our own ideas here, but students are expected to do some research and come up with their own ideas for projects. We have also written down some general tips on what to include in the application.
Applications can be submitted from March 20th, so there’s still plenty of time to have a play with Matrix and come up with a cool project idea!
We’re happy to announce the release of Synapse 0.19.0 (same as 0.19.0-rc4) today, just in time for anyone discovering Matrix for the first time at FOSDEM 2017! In fact, here’s Erik doing the release right now (with moral support from Luke):
This is a pretty big release, with a bunch of new features and lots and lots of debugging and optimisation work following on some of the dramas that we had with 0.18 over the Christmas break. The biggest things are:
IPv6 Support (unless you have an IPv6 only resolver), thanks to contributions from Glyph from Twisted and Kyrias!
A new API for tracking the E2E devices present in a room (required for fixing many of the remaining E2E bugs…)
Rewrite the ‘state resolution’ algorithm to be orders of magnitude more performant
Lots of tuning to the caching logic.
If you’re already running a server, please upgrade! And if you’re not, go grab yourself a brand new Synapse from Github. Debian packages will follow shortly (as soon as Erik can figure out the necessary backporting required for Twisted 16.6.0)
And here’s the full changelog…
Changes in synapse v0.19.0 (2017-02-04)
No changes since RC 4.
Changes in synapse v0.19.0-rc4 (2017-02-02)
Bump cache sizes for common membership queries (PR #1879)
TL;DR: Please upgrade to Synapse 0.18.6, especially if you are on 0.18.5 which is a bad release.
TL;DR: Please upgrade to Synapse 0.18.7– especially if you are on 0.18.5 or 0.18.6 which both have serious federation bugs.
Synapse 0.18.5 contained a really nasty regression in the federation code which causes servers to echo transactions that they receive back out to the other servers participating in a room. This has effectively resulted in a gradual amplification of federation traffic as more people have installed 0.18.5, causing every transaction to be received N times over where N is the number of servers in the room.
We’ll do a full write-up once we’re happy we’ve tracked down all the root problems here, but the short story is that this hit critical mass around Dec 26, where typical Synapses started to fail to keep up with the traffic – especially when requests hit some of the more inefficient or buggy codepaths in Synapse. As servers started to overload with inbound connections, this in turn started to slow down and consume resources on the connecting servers – especially due to an architectural mistake in Synapse which blocks inbound connections until the request has been fully processed (which could require the receiving server in turn to make outbound connections), rather than releasing the inbound connection asap. This hit the point that servers were running out of file descriptors due to all the outbound and inbound connections, at which point they started to entirely tarpit inbound connections, resulting in a slow feedback loop making the whole situation even worse.
We’ve spent the last two weeks hunting all the individual inefficient requests which were mysteriously starting to cause more problems than they ever had before; then trying to understand the feedback misbehaviour; before finally discovering the regression in 0.18.5 as the plausible root cause of the problem. Troubleshooting has been complicated by most of the team having unplugged for the holidays, and because this is the first (and hopefully last!) failure mode to be distributed across the whole network, making debugging something of a nightmare – especially when the overloading was triggering a plethora of different exotic failure modes. Huge thanks to everyone who has shared their server logs with the team to help debug this.
Some of these failure modes are still happening (and we’re working on fixing them), but we believe that if everyone upgrades away from the bad 0.18.5 release most of the symptoms will go away, or at least go back to being as bad as they were before. Meanwhile, if you find your server suddenly grinding to a halt after upgrading to 0.18.6 0.18.7 please come tell us in #matrix-dev:matrix.org.
We’re enormously sorry if you’ve been bitten by the federation instability this has caused – and many many thanks for your patience whilst we’ve hunted it down. On the plus side, it’s given us a lot of *very* useful insight into how to implement federation in future homeservers to not suffer from any of these failure modes. It’s also revealed the root cause of why Synapse’s RAM usage is quite so bad – it turns out that it actually idles at around 200MB with default caching, but there’s a particular codepath which causes it to spike temporarily by 1GB or so – and that RAM is then not released back to the OS. We’re working on a fix for this too, but it’ll come after 0.18.7.
Unfortunately the original release of 0.18.6 still exhibits the root bug, but 0.18.7 (originally released as 0.18.7-rc2) should finally fix this. Sorry for all the upgrades :(