3 research outputs found
A Tool for Describing and Checking Natural Semantics Definitions of Programming Languages
Many universities have courses and projects revolving around compiler or
interpreter implementation as part of their degree programmes in computer
science. In such teaching activities, tool support can be highly beneficial.
While there are already several tools for assisting with development of the
front end of compilers, tool support tapers off towards the back end, or
requires more background experience than is expected of undergraduate students.
Structural operational semantics is a useful and mathematically simple
formalism for specifying the behaviour of programs and a specification lends
itself well to implementation; in particular big-step or natural semantics is
often a useful and simple approach. However, many students struggle with
learning the notation and often come up with ill-defined and meaningless
attempts at defining a structural operational semantics. A survey shows that
students working on programming language projects feel that tool support is
lacking and would be useful.
Many of these problems encountered when developing a semantic definition are
similar to problems encountered in programming, in particular ones that are
essentially the result of type errors.
We present a pedagogical metalanguage based on natural semantics, and its
implementation, as an attempt to marry two notions: a syntax similar to
textbook notation for natural semantics on the one hand, and automatic
verification of some correctness properties on the other by means of a strong
type discipline. The metalanguage and the tool provide the facilities for
writing and executing specifications as a form of programming. The user can
check that the specification is not meaningless as well as execute programs, if
the specification makes sense.Comment: In Proceedings FROM 2022, arXiv:2209.0920
Unveiling and Vanquishing Goroutine Leaks in Enterprise Microservices: A Dynamic Analysis Approach
Go is a modern programming language gaining popularity in enterprise
microservice systems. Concurrency is a first-class citizen in Go with
lightweight ``goroutines'' as the building blocks of concurrent execution. Go
advocates message-passing to communicate and synchronize among goroutines.
Improper use of message passing in Go can result in ``partial deadlocks'' , a
subtle concurrency bug where a blocked sender (receiver) never finds a
corresponding receiver (sender), causing the blocked goroutine to leak memory,
via its call stack and objects reachable from the stack.
In this paper, we systematically study the prevalence of message passing and
the resulting partial deadlocks in 75 million lines of Uber's Go monorepo
hosting over 2500 microservices. We develop two lightweight, dynamic analysis
tools: Goleak and LeakProf, designed to identify partial deadlocks. Goleak
detects partial deadlocks during unit testing and prevents the introduction of
new bugs. Conversely, LeakProf uses goroutine profiles obtained from services
deployed in production to pinpoint intricate bugs arising from complex control
flow, unexplored interleavings, or the absence of test coverage. We share our
experience and insights deploying these tools in developer workflows in a large
industrial setting. Using Goleak we unearthed 857 pre-existing goroutine leaks
in the legacy code and prevented the introduction of around 260 new leaks over
one year period. Using LeakProf we found 24 and fixed 21 goroutine leaks, which
resulted in up to 34% speedup and 9.2x memory reduction in some of our
production services.Comment: 11 pages, 6 figures, to be published in CGO 202