Skip to content
This repository was archived by the owner on May 3, 2023. It is now read-only.

Conversation

@avaskys
Copy link

@avaskys avaskys commented Apr 3, 2019

When calling a function on a struct with a finalizer, the struct can
be destroyed/finalized within the function if it will no longer be
reachable. Example: https://play.golang.org/p/Lv19twqhDEU

This is fine in the example, but imagine if data were instead
a cgo pointer that gets freed by the finalizer. We'd end up
using the pointer after freeing it and badness would ensue.

Instead, we should ensure that the struct stays alive within any
functions in which its wrapped pointer is used. We can use
defer runtime.KeepAlive() to this end.

I looked for all structures that have a finalizer set and audited
their .ptr usage, adding runtime.KeepAlive()s as necessary.
This is probably a bit overkill, as the struct will stay alive
beyond most of those function calls, but IMO it's better to be
explicit here.

sramamoorthy and others added 30 commits March 18, 2019 00:18
atomicReplace currently does not preserve the
ownership and permission info, this fix will
preserves the ownership and permission info - it
fails the call if it is not able to do so.
…a and Python

Technically, they are still treated differently in Java and Python, but now, Java throws an exception if it encounters malformed UTF-16 to avoid serializing things in ways that it cannot deserialize. It also now throws an error when reading malformed UTF-8, which I think is safer as it stops it from accidentally doing something like reading bytes and then writing it back but accidentally writing to the wrong spot, but that might be a mistake.
Co-Authored-By: etschannen <[email protected]>
This is similar one to DataDistributor.
Popping the disk queue now requires potentially recovering the location
to which we can pop from the spilled data itself, and for each tag we
must maintain the first location with relevant data.

The previous queue we had to represent the ordering, queueOrder, was
used by spilling, and popped when a TLog had been spilled.  This means
that as soon as a TLog has been fully spilled, we have no idea how it
relates in order to other fully spilled TLogs.

Instead, use queueOrder to keep track of all the TLog UIDs until they're
removed, and use spillOrder to keep track of the order only for
spilling.
This time, track what location in the DiskQueue has been spilled in
persistent state, and then feed it back into the disk queue before
recovery.

This also introduces an ASSERT that recovery only reads exactly the
bytes that it needs to have in memory.
Occasionally log a backtrace when the fast allocators allocates a new magazine
…ough, and then pay back what was over the limit in the next update
Spill-By-Reference TLog Part 5: TLogs That Can Spill Large Amounts Of Data
Public address is required for roles FDBD, NetworkTestServer and
Restore only. Therefore, check those cases, and for others follow the
earlier behaviour of using default ip address 0.

FIXES apple#1305
atomicReplace to preserve owner & permission info
configure memory now selects the ssd engine for transaction log spilling
The mr-status-json-schemas.rst.inc file is a manually changed file
based on the automatically generated commented document about the JSON status
For 6.1 release, we use the script (will be removed) to generate the comment for JSON status docuemnt;
We manually change the docuemnt to document the 7 occurances of the map keyword
etschannen and others added 27 commits March 30, 2019 21:22
Python 2 resolves escape characters when printing byte strings,
which doesn't seem useful in this context.

I replaced __str__ since it defaults to __repr__ and the change
should be suitable for both cases.
Improve Python KeySelector representation
Python 2 resolves escape characters when printing byte strings,
which doesn't seem useful in this context.

I replaced __str__ since it defaults to __repr__ and the change
should be suitable for both cases.
Improve Python KeySelector representation (cherry-picked from master)
fix: Parse IPv6 addresses correctly in status details
…ch, to avoid multiple actors attempting to modify oldLogSystem at the same time
This fixes crashes from AsyncFileWinASIO refusing to open a file that
didn't have OPEN_UNBUFFERED.
Open incrementalDelete files with OPEN_UNBUFFERED
Bug fix, starting a restore on a tag already in-use would hang and eventually OOM
Cancel the previous log system recruitment before calling newEpoch
…we prefer issuing the batch over other possible work
Increase the priority of the client’s version batch timeout
When calling a function on a struct with a finalizer, the struct can
be destroyed/finalized within the function if it will no longer be
reachable. Example: https://play.golang.org/p/Lv19twqhDEU

This is fine in the example, but imagine if `data` were instead
a cgo pointer that gets freed by the finalizer. We'd end up
using the pointer after freeing it and badness would ensue.

Instead, we should ensure that the struct stays alive within any
functions in which its wrapped pointer is used. We can use
`defer runtime.KeepAlive()` to this end.

I looked for all structures that have a finalizer set and audited
their `.ptr` usage, adding `runtime.KeepAlive()`s as necessary.
This is probably a bit overkill, as the struct will stay alive
beyond most of those function calls, but IMO it's better to be
explicit here.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.