Page MenuHomePhabricator

Scopes Are Not Always Attached to ZObjects Correctly
Open, MediumPublicBUG REPORT

Description

Description

Steps to reproduce (step by step instructions, with links, commands and necessary data to reproduce the error)

Here is a test function call. DO NOT RUN IT ON BETA CLUSTER OR IN CI:

{
	"Z1K1": "Z7",
	"Z7K1": {
		"Z1K1": "Z8",
		"Z8K1": [
			"Z17",
			{
				"Z1K1": "Z17",
				"Z17K1": "Z8",
				"Z17K2": "Z10043K1",
				"Z17K3": {
					"Z1K1": "Z12",
					"Z12K1": [
						"Z11"
					]
				}
			}
		],
		"Z8K2": "Z1",
		"Z8K3": [
			"Z20"
		],
		"Z8K4": [
			"Z14",
			{
				"Z1K1": "Z14",
				"Z14K1": "Z10043",
				"Z14K2": {
					"Z1K1": "Z7",
					"Z7K1": {
						"Z1K1": "Z18",
						"Z18K1": "Z10043K1"
					},
					"K1": {
						"Z1K1": "Z18",
						"Z18K1": "Z10043K1"
					}
				}
			}
		],
		"Z8K5": "Z10043"
	},
	"Z10043K1": {
		"Z1K1": "Z8",
		"Z8K1": [
			"Z17",
			{
				"Z1K1": "Z17",
				"Z17K1": "Z8",
				"Z17K2": "Z10044K1",
				"Z17K3": {
					"Z1K1": "Z12",
					"Z12K1": [
						"Z11"
					]
				}
			}
		],
		"Z8K2": "Z1",
		"Z8K3": [
			"Z20"
		],
		"Z8K4": [
			"Z14",
			{
				"Z1K1": "Z14",
				"Z14K1": "Z10044",
				"Z14K2": {
					"Z1K1": "Z7",
					"Z7K1": {
						"Z1K1": "Z18",
						"Z18K1": "Z10044K1"
					},
					"K1": {
						"Z1K1": "Z18",
						"Z18K1": "Z10044K1"
					}
				}
			}
		],
		"Z8K5": "Z10044"
	}
}

This is similar to the following self-recursive Python code:

(lambda function(function))(lambda function(function))

SO:

  1. in function-orchestrator:src/frame.js::Frame::constructor(), add this.size_ the number of frames (i.e., this.size_ = this.lastFrame_ === null ? 0 : this.lastFrame_.size_ + 1)
  2. add console.log(this.size_)
  3. spin up a local development environment
  4. run the above self-recursive code IN THE LOCAL DEVELOPMENT ENVIRONMENT

Observed behavior

  • your environment will blow up
  • the function-orchestrator logs will show that the stack size did not grow unbounded but remain around 0/1
  • this is probably because the new scopes are not being attached properly
    • probably, when the Z7 compositions are executed as functions, their Z7K1 Functions keep the enclosing scope, rather than the new scope

Expected behavior/Acceptance criteria (returned value, expected error, performance expectations, etc.)

  • the stack size should have grown!

Completion checklist

Event Timeline

Un-assigning myself for now. This is one of the quality compromises we'll have to make for launch: we can't feasibly fix this now.

If the status on this is still the same, would it make sense to mark this as 'Low'? Sry to intrude, just scouring for a good BE task to pick up!

@ecarg I just saw your note. Not intruding at all. Some related issues have started to cause bugs in prod, so (in my opinion) this would absolutely be a worthwhile thing to look at for fix-it week!