varnish-cache/bin/varnishd/cache/cache_session.c
1
/*-
2
 * Copyright (c) 2006 Verdens Gang AS
3
 * Copyright (c) 2006-2011 Varnish Software AS
4
 * All rights reserved.
5
 *
6
 * Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
7
 *
8
 * Redistribution and use in source and binary forms, with or without
9
 * modification, are permitted provided that the following conditions
10
 * are met:
11
 * 1. Redistributions of source code must retain the above copyright
12
 *    notice, this list of conditions and the following disclaimer.
13
 * 2. Redistributions in binary form must reproduce the above copyright
14
 *    notice, this list of conditions and the following disclaimer in the
15
 *    documentation and/or other materials provided with the distribution.
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
 * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
21
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27
 * SUCH DAMAGE.
28
 *
29
 * Session management
30
 *
31
 * The overall goal here is to hold as little state as possible for an
32
 * idle session.  This leads to various nasty-ish overloads of struct
33
 * sess fields, for instance ->fd being negative ->reason.
34
 *
35
 */
36
37
#include "config.h"
38
39
#include "cache_varnishd.h"
40
41
#include <errno.h>
42
#include <stdio.h>
43
#include <stdlib.h>
44
45
#include "cache_pool.h"
46
#include "cache_transport.h"
47
48
#include "vsa.h"
49
#include "vtcp.h"
50
#include "vtim.h"
51
#include "waiter/waiter.h"
52
53
/*--------------------------------------------------------------------*/
54
55
void
56 3044
SES_SetTransport(struct worker *wrk, struct sess *sp, struct req *req,
57
    const struct transport *xp)
58
{
59
60 3044
        CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
61 3044
        CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
62 3044
        CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
63 3044
        CHECK_OBJ_NOTNULL(xp, TRANSPORT_MAGIC);
64 3044
        assert(xp->number > 0);
65
66 3044
        sp->sattr[SA_TRANSPORT] = xp->number;
67 3044
        req->transport = xp;
68 3044
        wrk->task.func = xp->new_session;
69 3044
        wrk->task.priv = req;
70 3044
}
71
72
/*--------------------------------------------------------------------*/
73
74
static int
75 29161
ses_get_attr(const struct sess *sp, enum sess_attr a, void **dst)
76
{
77 29161
        CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
78 29161
        assert(a < SA_LAST);
79 29161
        AN(dst);
80
81 29161
        if (sp->sattr[a] == 0xffff) {
82 0
                *dst = NULL;
83 0
                return (-1);
84
        } else {
85 29161
                *dst = sp->ws->s + sp->sattr[a];
86 29161
                return (0);
87
        }
88
}
89
90
static int
91 15634
ses_set_attr(const struct sess *sp, enum sess_attr a, const void *src, int sz)
92
{
93
        void *dst;
94 15634
        CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
95 15634
        assert(a < SA_LAST);
96 15634
        AN(src);
97 15634
        assert(sz > 0);
98
99 15634
        if (sp->sattr[a] == 0xffff)
100 0
                return (-1);
101 15634
        dst = sp->ws->s + sp->sattr[a];
102 15634
        AN(dst);
103 15634
        memcpy(dst, src, sz);
104 15634
        return (0);
105
}
106
107
static void
108 14359
ses_reserve_attr(struct sess *sp, enum sess_attr a, void **dst, int sz)
109
{
110
        ssize_t o;
111
112 14359
        CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
113 14359
        assert(a < SA_LAST);
114 14359
        assert(sz >= 0);
115 14359
        AN(dst);
116 14359
        o = WS_Reserve(sp->ws, sz);
117 14359
        assert(o >= sz);
118 14359
        *dst = sp->ws->f;
119 14359
        o = sp->ws->f - sp->ws->s;
120 14359
        WS_Release(sp->ws, sz);
121 14357
        assert(o >= 0 && o <= 0xffff);
122 14357
        sp->sattr[a] = (uint16_t)o;
123 14357
}
124
125
#define SESS_ATTR(UP, low, typ, len)                                    \
126
        int                                                             \
127
        SES_Set_##low(const struct sess *sp, const typ *src)            \
128
        {                                                               \
129
                return (ses_set_attr(sp, SA_##UP, src, len));           \
130
        }                                                               \
131
                                                                        \
132
        int                                                             \
133
        SES_Get_##low(const struct sess *sp, typ **dst)                 \
134
        {                                                               \
135
                return (ses_get_attr(sp, SA_##UP, (void**)dst));        \
136
        }                                                               \
137
                                                                        \
138
        void                                                            \
139
        SES_Reserve_##low(struct sess *sp, typ **dst)                   \
140
        {                                                               \
141
                assert(len >= 0);                                       \
142
                ses_reserve_attr(sp, SA_##UP, (void**)dst, len);        \
143
        }
144
145
#include "tbl/sess_attr.h"
146
147
void
148 5752
SES_Set_String_Attr(struct sess *sp, enum sess_attr a, const char *src)
149
{
150
        void *q;
151
152 5752
        CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
153 5752
        AN(src);
154
155 5752
        switch (a) {
156
#define SESS_ATTR(UP, low, typ, len)    case SA_##UP: assert(len < 0); break;
157
#include "tbl/sess_attr.h"
158 0
        default:  WRONG("wrong sess_attr");
159
        }
160
161 5752
        ses_reserve_attr(sp, a, &q, strlen(src) + 1);
162 5752
        strcpy(q, src);
163 5752
}
164
165
const char *
166 9940
SES_Get_String_Attr(const struct sess *sp, enum sess_attr a)
167
{
168
        void *q;
169
170 9940
        CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
171
172 9940
        switch (a) {
173
#define SESS_ATTR(UP, low, typ, len)    case SA_##UP: assert(len < 0); break;
174
#include "tbl/sess_attr.h"
175 0
        default:  WRONG("wrong sess_attr");
176
        }
177
178 9940
        if (ses_get_attr(sp, a, &q) < 0)
179 0
                return (NULL);
180 9940
        return (q);
181
}
182
183
/*--------------------------------------------------------------------*/
184
185
const char *
186 28
HTC_Status(enum htc_status_e e)
187
{
188 28
        switch (e) {
189
#define HTC_STATUS(e, n, s, l)                          \
190
                case HTC_S_ ## e:       return (s);
191
#include "tbl/htc.h"
192
        default:
193 0
                WRONG("HTC_Status");
194
        }
195
        NEEDLESS(return (NULL));
196
}
197
198
/*--------------------------------------------------------------------*/
199
200
void
201 10858
HTC_RxInit(struct http_conn *htc, struct ws *ws)
202
{
203
        ssize_t l;
204
205 10858
        CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC);
206 10858
        htc->ws = ws;
207 10858
        (void)WS_Reserve(htc->ws, 0);
208 10858
        htc->rxbuf_b = ws->f;
209 10858
        htc->rxbuf_e = ws->f;
210 10858
        if (htc->pipeline_b != NULL) {
211 115
                AN(htc->pipeline_e);
212
                // assert(WS_Inside(ws, htc->pipeline_b, htc->pipeline_e));
213 115
                l = htc->pipeline_e - htc->pipeline_b;
214 115
                assert(l > 0);
215 115
                assert(l <= ws->r - htc->rxbuf_b);
216 115
                memmove(htc->rxbuf_b, htc->pipeline_b, l);
217 115
                htc->rxbuf_e += l;
218 115
                htc->pipeline_b = NULL;
219 115
                htc->pipeline_e = NULL;
220
        }
221 10858
}
222
223
void
224 8276
HTC_RxPipeline(struct http_conn *htc, void *p)
225
{
226
227 8276
        CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC);
228 8276
        if (p == NULL || (char*)p == htc->rxbuf_e) {
229 6287
                htc->pipeline_b = NULL;
230 6287
                htc->pipeline_e = NULL;
231
        } else {
232 1989
                assert((char*)p >= htc->rxbuf_b);
233 1989
                assert((char*)p < htc->rxbuf_e);
234 1989
                htc->pipeline_b = p;
235 1989
                htc->pipeline_e = htc->rxbuf_e;
236
        }
237 8276
}
238
239
/*----------------------------------------------------------------------
240
 * Receive a request/packet/whatever, with timeouts
241
 *
242
 * maxbytes is the maximum number of bytes the caller expects to need to
243
 * reach a complete work unit. Note that due to pipelining the actual
244
 * number of bytes passed to func in htc->rxbuf_b through htc->rxbuf_e may
245
 * be larger.
246
 *
247
 * t0 is when we start
248
 * *t1 becomes time of first non-idle rx
249
 * *t2 becomes time of complete rx
250
 * ti is when we return IDLE if nothing has arrived
251
 * tn is when we timeout on non-complete
252
 */
253
254
enum htc_status_e
255 10858
HTC_RxStuff(struct http_conn *htc, htc_complete_f *func,
256
    double *t1, double *t2, double ti, double tn, int maxbytes)
257
{
258
        double tmo;
259
        double now;
260
        enum htc_status_e hs;
261
        ssize_t z;
262
263 10858
        CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC);
264 10858
        AN(htc->rfd);
265 10858
        assert(*htc->rfd > 0);
266 10858
        AN(htc->ws->r);
267 10858
        AN(htc->rxbuf_b);
268 10858
        assert(htc->rxbuf_b <= htc->rxbuf_e);
269 10858
        assert(htc->rxbuf_e <= htc->ws->r);
270
271 10858
        AZ(isnan(tn));
272 10858
        if (t1 != NULL)
273 6834
                assert(isnan(*t1));
274
275 10858
        if (htc->rxbuf_e == htc->ws->r) {
276
                /* Can't work with a zero size buffer */
277 4
                WS_ReleaseP(htc->ws, htc->rxbuf_b);
278 4
                return (HTC_S_OVERFLOW);
279
        }
280 10854
        z = (htc->ws->r - htc->rxbuf_b);
281 10854
        if (z < maxbytes)
282 260
                maxbytes = z;   /* Cap maxbytes at available WS */
283
284
        while (1) {
285 30176
                now = VTIM_real();
286 20516
                AZ(htc->pipeline_b);
287 20516
                AZ(htc->pipeline_e);
288 20516
                assert(htc->rxbuf_e <= htc->ws->r);
289
290 20516
                hs = func(htc);
291 20516
                if (hs == HTC_S_OVERFLOW || hs == HTC_S_JUNK) {
292 6
                        WS_ReleaseP(htc->ws, htc->rxbuf_b);
293 6
                        return (hs);
294
                }
295 20510
                if (hs == HTC_S_COMPLETE) {
296 8354
                        WS_ReleaseP(htc->ws, htc->rxbuf_e);
297
                        /* Got it, run with it */
298 8354
                        if (t1 != NULL && isnan(*t1))
299 4314
                                *t1 = now;
300 8354
                        if (t2 != NULL)
301 4478
                                *t2 = now;
302 8354
                        return (HTC_S_COMPLETE);
303
                }
304 12156
                if (hs == HTC_S_MORE) {
305
                        /* Working on it */
306 1926
                        if (t1 != NULL && isnan(*t1))
307 168
                                *t1 = now;
308 10230
                } else if (hs == HTC_S_EMPTY)
309 10230
                        htc->rxbuf_e = htc->rxbuf_b;
310
                else
311 0
                        WRONG("htc_status_e");
312
313 12156
                tmo = tn - now;
314 12156
                if (!isnan(ti) && ti < tn && hs == HTC_S_EMPTY)
315 10224
                        tmo = ti - now;
316 12156
                z = maxbytes - (htc->rxbuf_e - htc->rxbuf_b);
317 12156
                if (z <= 0) {
318
                        /* maxbytes reached but not HTC_S_COMPLETE. Return
319
                         * overflow. */
320 28
                        WS_ReleaseP(htc->ws, htc->rxbuf_b);
321 28
                        return (HTC_S_OVERFLOW);
322
                }
323 12128
                if (tmo <= 0.0)
324 485
                        tmo = 1e-3;
325 12128
                z = VTCP_read(*htc->rfd, htc->rxbuf_e, z, tmo);
326 12125
                if (z == 0 || z == -1) {
327 2200
                        WS_ReleaseP(htc->ws, htc->rxbuf_b);
328 2200
                        return (HTC_S_EOF);
329 9925
                } else if (z > 0)
330 9380
                        htc->rxbuf_e += z;
331 545
                else if (z == -2) {
332 545
                        if (hs == HTC_S_EMPTY && ti <= now) {
333 258
                                WS_ReleaseP(htc->ws, htc->rxbuf_b);
334 258
                                return (HTC_S_IDLE);
335
                        }
336 287
                        if (tn <= now) {
337 6
                                WS_ReleaseP(htc->ws, htc->rxbuf_b);
338 6
                                return (HTC_S_TIMEOUT);
339
                        }
340
                }
341
        }
342
}
343
344
/*--------------------------------------------------------------------
345
 * Get a new session, preferably by recycling an already ready one
346
 *
347
 * Layout is:
348
 *      struct sess
349
 *      workspace
350
 */
351
352
struct sess *
353 2810
SES_New(struct pool *pp)
354
{
355
        struct sess *sp;
356
        unsigned sz;
357
        char *p, *e;
358
359 2810
        CHECK_OBJ_NOTNULL(pp, POOL_MAGIC);
360 2810
        sp = MPL_Get(pp->mpl_sess, &sz);
361 2810
        sp->magic = SESS_MAGIC;
362 2810
        sp->pool = pp;
363 2810
        sp->refcnt = 1;
364 2810
        memset(sp->sattr, 0xff, sizeof sp->sattr);
365
366 2810
        e = (char*)sp + sz;
367 2810
        p = (char*)(sp + 1);
368 2810
        p = (void*)PRNDUP(p);
369 2810
        assert(p < e);
370 2810
        WS_Init(sp->ws, "ses", p, e - p);
371
372 2810
        sp->t_open = NAN;
373 2810
        sp->t_idle = NAN;
374 2810
        Lck_New(&sp->mtx, lck_sess);
375 2810
        CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
376 2810
        return (sp);
377
}
378
379
/*--------------------------------------------------------------------
380
 * Handle a session (from waiter)
381
 */
382
383
static void v_matchproto_(waiter_handle_f)
384 250
ses_handle(struct waited *wp, enum wait_event ev, double now)
385
{
386
        struct sess *sp;
387
        struct pool *pp;
388
        struct pool_task *tp;
389
        const struct transport *xp;
390
391 250
        CHECK_OBJ_NOTNULL(wp, WAITED_MAGIC);
392 250
        CAST_OBJ_NOTNULL(sp, wp->priv1, SESS_MAGIC);
393 250
        CAST_OBJ_NOTNULL(xp, (const void*)wp->priv2, TRANSPORT_MAGIC);
394 250
        AN(wp->priv2);
395 250
        assert((void *)sp->ws->f == wp);
396 250
        wp->magic = 0;
397 250
        wp = NULL;
398
399 250
        WS_Release(sp->ws, 0);
400
401 250
        switch (ev) {
402
        case WAITER_TIMEOUT:
403 8
                SES_Delete(sp, SC_RX_TIMEOUT, now);
404 8
                break;
405
        case WAITER_REMCLOSE:
406 22
                SES_Delete(sp, SC_REM_CLOSE, now);
407 22
                break;
408
        case WAITER_ACTION:
409 220
                pp = sp->pool;
410 220
                CHECK_OBJ_NOTNULL(pp, POOL_MAGIC);
411 220
                assert(sizeof *tp <= WS_Reserve(sp->ws, sizeof *tp));
412 220
                tp = (void*)sp->ws->f;
413 220
                tp->func = xp->unwait;
414 220
                tp->priv = sp;
415 220
                if (Pool_Task(pp, tp, TASK_QUEUE_REQ))
416 0
                        SES_Delete(sp, SC_OVERLOAD, now);
417 220
                break;
418
        case WAITER_CLOSE:
419 0
                WRONG("Should not see WAITER_CLOSE on client side");
420
                break;
421
        default:
422 0
                WRONG("Wrong event in ses_handle");
423
        }
424 250
}
425
426
/*--------------------------------------------------------------------
427
 */
428
429
void
430 250
SES_Wait(struct sess *sp, const struct transport *xp)
431
{
432
        struct pool *pp;
433
        struct waited *wp;
434
435 250
        CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
436 250
        CHECK_OBJ_NOTNULL(xp, TRANSPORT_MAGIC);
437 250
        pp = sp->pool;
438 250
        CHECK_OBJ_NOTNULL(pp, POOL_MAGIC);
439 250
        assert(sp->fd > 0);
440
        /*
441
         * XXX: waiter_epoll prevents us from zeroing the struct because
442
         * XXX: it keeps state across calls.
443
         */
444 250
        if (VTCP_nonblocking(sp->fd)) {
445 0
                SES_Delete(sp, SC_REM_CLOSE, NAN);
446 0
                return;
447
        }
448
449
        /*
450
         * put struct waited on the workspace
451
         */
452 250
        if (WS_Reserve(sp->ws, sizeof(struct waited))
453
            < sizeof(struct waited)) {
454 0
                SES_Delete(sp, SC_OVERLOAD, NAN);
455 0
                return;
456
        }
457 250
        wp = (void*)sp->ws->f;
458 250
        INIT_OBJ(wp, WAITED_MAGIC);
459 250
        wp->fd = sp->fd;
460 250
        wp->priv1 = sp;
461 250
        wp->priv2 = (uintptr_t)xp;
462 250
        wp->idle = sp->t_idle;
463 250
        wp->func = ses_handle;
464 250
        wp->tmo = &cache_param->timeout_idle;
465 250
        if (Wait_Enter(pp->waiter, wp))
466 0
                SES_Delete(sp, SC_PIPE_OVERFLOW, NAN);
467
}
468
469
/*--------------------------------------------------------------------
470
 * Update sc_ counters by reason
471
 *
472
 * assuming that the approximation of non-atomic global counters is sufficient.
473
 * if not: update to per-wrk
474
 */
475
476
static void
477 2796
ses_close_acct(enum sess_close reason)
478
{
479 2796
        int i = 0;
480
481 2796
        assert(reason != SC_NULL);
482 2796
        switch (reason) {
483
#define SESS_CLOSE(reason, stat, err, desc)             \
484
        case SC_ ## reason:                             \
485
                VSC_C_main->sc_ ## stat++;              \
486
                i = err;                                \
487
                break;
488
#include "tbl/sess_close.h"
489
490
        default:
491 0
                WRONG("Wrong event in ses_close_acct");
492
        }
493 2796
        if (i)
494 504
                VSC_C_main->sess_closed_err++;
495 2796
}
496
497
/*--------------------------------------------------------------------
498
 * Close a session's connection.
499
 * XXX: Technically speaking we should catch a t_end timestamp here
500
 * XXX: for SES_Delete() to use.
501
 */
502
503
void
504 2796
SES_Close(struct sess *sp, enum sess_close reason)
505
{
506
        int i;
507
508 2796
        assert(reason > 0);
509 2796
        assert(sp->fd > 0);
510 2796
        i = close(sp->fd);
511 2796
        assert(i == 0 || errno != EBADF); /* XXX EINVAL seen */
512 2796
        sp->fd = -(int)reason;
513 2796
        ses_close_acct(reason);
514 2796
}
515
516
/*--------------------------------------------------------------------
517
 * Report and dismantle a session.
518
 */
519
520
void
521 2796
SES_Delete(struct sess *sp, enum sess_close reason, double now)
522
{
523
524 2796
        CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
525
526 2796
        if (reason != SC_NULL)
527 2328
                SES_Close(sp, reason);
528 2796
        assert(sp->fd < 0);
529
530 2796
        if (isnan(now))
531 2766
                now = VTIM_real();
532 2796
        AZ(isnan(sp->t_open));
533 2796
        if (now < sp->t_open) {
534 0
                VSL(SLT_Debug, sp->vxid,
535
                    "Clock step (now=%f < t_open=%f)",
536
                    now, sp->t_open);
537 0
                if (now + cache_param->clock_step < sp->t_open)
538 0
                        WRONG("Clock step detected");
539 0
                now = sp->t_open; /* Do not log negatives */
540
        }
541
542 2796
        if (reason == SC_NULL)
543 468
                reason = (enum sess_close)-sp->fd;
544
545 2796
        VSL(SLT_SessClose, sp->vxid, "%s %.3f",
546 2796
            sess_close_2str(reason, 0), now - sp->t_open);
547 2796
        VSL(SLT_End, sp->vxid, "%s", "");
548 2796
        if (WS_Overflowed(sp->ws))
549 2
                VSC_C_main->ws_session_overflow++;
550 2796
        SES_Rel(sp);
551 2796
}
552
553
/*--------------------------------------------------------------------
554
 */
555
556
void
557 3802
SES_Ref(struct sess *sp)
558
{
559
560 3802
        CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
561 3802
        Lck_Lock(&sp->mtx);
562 3802
        assert(sp->refcnt > 0);
563 3802
        sp->refcnt++;
564 3802
        Lck_Unlock(&sp->mtx);
565 3802
}
566
567
void
568 6596
SES_Rel(struct sess *sp)
569
{
570
        int i;
571
        struct pool *pp;
572
573 6596
        CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
574 6596
        pp = sp->pool;
575 6596
        CHECK_OBJ_NOTNULL(pp, POOL_MAGIC);
576
577 6596
        Lck_Lock(&sp->mtx);
578 6596
        assert(sp->refcnt > 0);
579 6596
        i = --sp->refcnt;
580 6596
        Lck_Unlock(&sp->mtx);
581 6596
        if (i)
582 3800
                return;
583 2796
        Lck_Delete(&sp->mtx);
584 2796
        MPL_Free(sp->pool->mpl_sess, sp);
585
}
586
587
/*--------------------------------------------------------------------
588
 * Create and delete pools
589
 */
590
591
void
592 2734
SES_NewPool(struct pool *pp, unsigned pool_no)
593
{
594
        char nb[8];
595
596 2734
        CHECK_OBJ_NOTNULL(pp, POOL_MAGIC);
597 2734
        bprintf(nb, "req%u", pool_no);
598 2734
        pp->mpl_req = MPL_New(nb, &cache_param->req_pool,
599 2734
            &cache_param->workspace_client);
600 2734
        bprintf(nb, "sess%u", pool_no);
601 2734
        pp->mpl_sess = MPL_New(nb, &cache_param->sess_pool,
602 2734
            &cache_param->workspace_session);
603
604 2734
        pp->waiter = Waiter_New();
605 2734
}
606
607
void
608 4
SES_DestroyPool(struct pool *pp)
609
{
610 4
        MPL_Destroy(&pp->mpl_req);
611 4
        MPL_Destroy(&pp->mpl_sess);
612 4
        Waiter_Destroy(&pp->waiter);
613 4
}